Net::S...reDate(3pm)
β¨ NAME β¨
Net::SSL::ExpireDate β bestie, this is the module that goes and gets you the expiration date of a certificate π
Like, it's in the User Contributed Perl Documentation corner of the perl(3pm) manual universe, and its whole personality is: hand it a cert, get the date back.
π SYNOPSIS π
use Net::SSL::ExpireDate;
$ed = Net::SSL::ExpireDate->new( https => 'example.com' );
$ed = Net::SSL::ExpireDate->new( https => 'example.com:10443' );
$ed = Net::SSL::ExpireDate->new( ssl => 'example.com:465' ); # smtps
$ed = Net::SSL::ExpireDate->new( ssl => 'example.com:995' ); # pop3s
$ed = Net::SSL::ExpireDate->new( file => '/etc/ssl/cert.pem' );
if (defined $ed->expire_date) {
# do something
$expire_date = $ed->expire_date; # return DateTime instance
$expired = $ed->is_expired; # examine already expired
$expired = $ed->is_expired('2 months'); # will expire after 2 months
$expired = $ed->is_expired(DateTime::Duration->new(months=>2)); # ditto
}
π¦ DESCRIPTION π¦
Okay so the way this works is: Net::SSL::ExpireDate goes and grabs a certificate β either off the network over SSL, or straight off your local filesystem β and then pulls out its expiration date. That's the whole vibe. Certificate in, date out. Periodt. β¨
π METHODS π
πΈ new
$ed = Net::SSL::ExpireDate->new( %option )
This constructs a brand-new Net::SSL::ExpireDate instance and hands it back to you, no cap. The %option is how you tell it which certificate you're talking about π
KEY VALUE
----------------------------
ssl "hostname[:port]"
https (same as above ssl)
file "path/to/certificate"
timeout "Timeout in seconds"
sni "Server Name Indicator"
πΈ expire_date
$expire_date = $ed->expire_date;
Returns the expiration date, as a DateTime instance. Simple as that π
πΈ begin_date
$begin_date = $ed->begin_date;
Returns the beginning date, also as a DateTime instance. It's giving "when did this cert start existing" energy π£
πΈ not_after
A synonym for expire_date. Same thing, different name, we love an alias β¨
πΈ not_before
A synonym for begin_date. Also an alias. Also slaying π
πΈ is_expired
$expired = $ed->is_expired;
Tells you whether the thing is already expired or not. Vibe check on the cert π΅οΈ
You can also pass an interval, and then it'll tell you whether it will expire in that future window. Acceptable intervals are a human readable string (parsed by Time::Duration::Parse) or a DateTime::Duration instance.
# will expire after 2 months
$expired = $ed->is_expired('2 months');
$expired = $ed->is_expired(DateTime::Duration->new(months=>2));
πΈ type
Returns the type of the examinee certificate. It's "ssl" or "file". Pick your fighter π₯
πΈ target
Returns the hostname, or the path, of the examinee certificate. Basically "who are we even checking here" π
π BUGS AND LIMITATIONS π
No bugs have been reported. (Not me being suspiciously perfect π)
Please report any bugs or feature requests to bug-net-ssl-expiredate@rt.cpan.org, or through the web interface at <http://rt.cpan.org>.
fr fr, if you find a bug, tell them β that's the whole point of that address π«Ά
π AUTHOR π
HIROSE Masaaki <hirose31 _at_ gmail.com>
π REPOSITORY π
<http://github.com/hirose31/net-ssl-expiredate>
git clone git://github.com/hirose31/net-ssl-expiredate.git
patches and collaborators are welcome. (Come through, contributors πβ¨)
β SEE ALSO β
Nothing listed here, bestie. This section is literally empty. An icon of minimalism. π«Ά
π COPYRIGHT & LICENSE π
Copyright HIROSE Masaaki
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
And that's the whole page, babes β perl v5.40.0 said it, dated 2024-12-27, and it lives at Net::S...reDate(3pm). Go check some certs, stay unexpired, mwah π
π¦ where this page comes from
- debian trixie: libnet-ssl-expiredate-perl 1.25-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libnet-ssl-expiredate-perl 1.25-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libnet-ssl-expiredate-perl 1.25-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms