summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl0/lib/Crypt/SSLeay/X509.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/tlpkg/tlperl0/lib/Crypt/SSLeay/X509.pm')
-rwxr-xr-xMaster/tlpkg/tlperl0/lib/Crypt/SSLeay/X509.pm26
1 files changed, 26 insertions, 0 deletions
diff --git a/Master/tlpkg/tlperl0/lib/Crypt/SSLeay/X509.pm b/Master/tlpkg/tlperl0/lib/Crypt/SSLeay/X509.pm
new file mode 100755
index 00000000000..5fd50ca6cb7
--- /dev/null
+++ b/Master/tlpkg/tlperl0/lib/Crypt/SSLeay/X509.pm
@@ -0,0 +1,26 @@
+package Crypt::SSLeay::X509;
+
+use strict;
+
+sub not_before {
+ my $cert = shift;
+ not_string2time($cert->get_notBeforeString);
+}
+
+sub not_after {
+ my $cert = shift;
+ not_string2time($cert->get_notAfterString);
+}
+
+sub not_string2time {
+ my $string = shift;
+ # $string has the form 021019235959Z
+ my($year, $month, $day, $hour, $minute, $second, $GMT)=
+ $string=~m/(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(Z)?/;
+ $year += 2000;
+ my $time="$year-$month-$day $hour:$minute:$second";
+ $time .= " GMT" if $GMT;
+ $time;
+}
+
+1;