Home

Awesome

NAME

Crypt::OpenSSL::X509 - Perl extension to OpenSSL's X509 API.

SYNOPSIS

use Crypt::OpenSSL::X509;

my $x509 = Crypt::OpenSSL::X509->new_from_file('cert.pem');

print $x509->pubkey() . "\n";
print $x509->subject() . "\n";
print $x509->hash() . "\n";
print $x509->email() . "\n";
print $x509->issuer() . "\n";
print $x509->issuer_hash() . "\n";
print $x509->notBefore() . "\n";
print $x509->notAfter() . "\n";
print $x509->modulus() . "\n";
print $x509->exponent() . "\n";
print $x509->fingerprint_md5() . "\n";
print $x509->fingerprint_sha256() . "\n";
print $x509->as_string() . "\n";

my $x509 = Crypt::OpenSSL::X509->new_from_string(
  $der_encoded_data, Crypt::OpenSSL::X509::FORMAT_ASN1
);

# given a time offset of $seconds, will the certificate be valid?
if ($x509->checkend($seconds)) {
  # cert is expired at $seconds offset
} else {
  # cert is ok at $seconds offset
}

my $exts = $x509->extensions_by_oid();

foreach my $oid (keys %$exts) {
  my $ext = $$exts{$oid};
  print $oid, " ", $ext->object()->name(), ": ", $ext->value(), "\n";
}

ABSTRACT

Crypt::OpenSSL::X509 - Perl extension to OpenSSL's X509 API.

DESCRIPTION

This implement a large majority of OpenSSL's useful X509 API.

The email() method supports both certificates where the
subject is of the form:
"... CN=Firstname lastname/emailAddress=user@domain", and also
certificates where there is a X509v3 Extension of the form
"X509v3 Subject Alternative Name: email=user@domain".

EXPORT

None by default.

On request:

    FORMAT_UNDEF FORMAT_ASN1 FORMAT_TEXT FORMAT_PEM
    FORMAT_PKCS12 FORMAT_SMIME FORMAT_ENGINE FORMAT_IISSGC

FUNCTIONS

X509 CONSTRUCTORS

X509 ACCESSORS

X509 METHODS

X509::Extension METHODS

X509::ObjectID METHODS

X509::Name METHODS

X509::Name_Entry METHODS

ISSUE REPORTING

Please report any bugs or feature requests using GitHub.

SEE ALSO

AUTHOR

ACKNOWLEDGEMENTS

In alphabetical order.

COPYRIGHT AND LICENSE

Copyright 2004-2022 by Dan Sully

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.