X509(3pm) | User Contributed Perl Documentation | X509(3pm) |
Crypt::OpenSSL::X509 - Perl extension to OpenSSL's X509 API.
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"; }
Crypt::OpenSSL::X509 - Perl extension to OpenSSL's X509 API.
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".
None by default.
On request:
FORMAT_UNDEF FORMAT_ASN1 FORMAT_TEXT FORMAT_PEM FORMAT_PKCS12 FORMAT_SMIME FORMAT_ENGINE FORMAT_IISSGC
OpenSSL(1), Crypt::OpenSSL::RSA, Crypt::OpenSSL::Bignum
Dan Sully
Copyright 2004-2019 by Dan Sully
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
2020-11-20 | perl v5.32.0 |