Net::S...reDate(3pm)

πŸ“¦ version 1.25, in debian trixie, ubuntu resolute, ubuntu stonking

✨ 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 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