1package Crypt::SSLeay::X509;
2
3use strict;
4
5sub not_before {
6    my $cert = shift;
7    not_string2time($cert->get_notBeforeString);
8}
9
10sub not_after {
11    my $cert = shift;
12    not_string2time($cert->get_notAfterString);
13}
14
15sub not_string2time {
16    my $string = shift;
17    # $string has the form 021019235959Z
18    my($year, $month, $day, $hour, $minute, $second, $GMT)=
19        $string=~m/(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(Z)?/;
20    $year += 2000;
21    my $time="$year-$month-$day $hour:$minute:$second";
22    $time .= " GMT" if $GMT;
23    $time;
24}
25
261;
27