perl-crypt-openssl-x509 icon indicating copy to clipboard operation
perl-crypt-openssl-x509 copied to clipboard

Not before / Not after as epoch

Open vipera opened this issue 7 years ago • 0 comments

Hi! I'm enjoying this module and it would be great if it could return the x509 not before / not after as a UNIX timestamp instead of just as a formatted date.

I'm thinking about something like this:

print $x509->not_before_epoch() . "\n"; # 822870000
print $x509->not_after_epoch() . "\n"; # 1578437999

Since OpenSSL 1.1.1 there's an ASN1_TIME_to_tm function that simplifies this. I've already made a build that works by calling that function and exposing two additional accessors, but I'm wondering:

  1. is there a minimum OpenSSL version to target
  2. what I should do if the version is lower than 1.1.1
  3. whether you want this upstream and think it's a good idea.

I'd be glad to prepare a pull request if I could get some input on these things!

vipera avatar Nov 27 '18 14:11 vipera