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
- subject
- Subject name as a string.
- issuer
- Issuer name as a string.
- issuer_hash
- Issuer name hash as a string.
- serial
- Serial number as a string.
- hash
- Alias for subject_hash
- subject_hash
- Subject name hash as a string.
- notBefore
- "notBefore" time as a string.
- notAfter
- "notAfter" time as a string.
- email
- Email addresses as string, if multiple addresses found, they are separated
by a space (' ').
- version
- Certificate version as a string.
- sig_alg_name
- Signature algorithm name as a string.
- key_alg_name
- Public key algorithm name as a string.
- curve
- Name of the EC curve used in the public key.
- critical ( )
- Return a value indicating if the extension is critical or not. FIXME: the
value is an ASN.1 BOOLEAN value.
- object ( )
- Return the ObjectID of the extension. Methods for handling ObjectID
objects are given below.
- value ( )
- Return the value of the extension as an asn1parse(1) style hex
dump.
- as_string (
)
- Return a human-readable version of the extension as formatted by
X509V3_EXT_print. Note that this will return an empty string for OIDs with
unknown ASN.1 encodings.
- name ( )
- Return the long name of the object as a string.
- oid ( )
- Return the numeric dot-separated form of the object identifier as a
string.
Please report any bugs or feature requests using
GitHub.
- •
- GitHub Issues
<https://github.com/dsully/perl-crypt-openssl-x509/issues>
- OpenSSL website <https://www.openssl.org/>
- Crypt::OpenSSL::RSA
<https://metacpan.org/pod/Crypt::OpenSSL::RSA>
- Crypt::OpenSSL::Bignum
<https://metacpan.org/pod/Crypt::OpenSSL::Bignum>
- Crypt::OpenSSL::Guess
<https://metacpan.org/pod/Crypt::OpenSSL::Guess>
- Dan Sully, original author
- Jonas Brømsø, current maintainer
- Please see the "ACKNOWLEDGEMENTS" section for a list of
contributors.
In alphabetical order.
- @eserte
- @kmx
- @stphnlyd
- Ashley Hindmarsh @bestscarper
- Bernhard M. Wiedemann @bmwiedemann
- Brad Davidson @brandond
- Daniel Kahn Gillmor
- Daniel Risacher
- David O'Callaghan
- David Steinbrunner @dsteinbrunner
- dsteinwand
- Florian Schlichting @fschlich
- IKEDA Soji @ikedas
- James Hunt @jhunt
- James Rouzier @jrouzierinverse
- Johanna @0xxon
- Jonas Brømsø @jonasbn
- Louise Doran
- Michael McClimon @mmcclimon
- Michal Josef Špaček
@michal-josef-spacek
- Neil Bowers @neilb
- Nicholas Harteau
- Otmar Lendl
- Patrick C. @errror
- Patrick Cernko
- Petr Pisar @ppisar
- pi-rho
- Salvador Fandiño @salva
- Sebastian Andrzej Siewior
- Sho Nakatani @laysakura
- Shoichi Kaji @skaji
- Timothy Legge @timlegge
- Todd Rinaldo @toddr
- Uli Scholler
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.