home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / ssl / X509.pm < prev    next >
Encoding:
Perl POD Document  |  2004-03-20  |  646 b   |  27 lines

  1. package Crypt::SSLeay::X509;
  2.  
  3. sub not_before {
  4.     my $cert=shift;
  5.     my $not_before_string=$cert->get_notBeforeString;
  6.     ¬_string2time($not_before_string);
  7. }
  8.  
  9. sub not_after {
  10.     my $cert=shift;
  11.     my $not_after_string=$cert->get_notAfterString;
  12.     ¬_string2time($not_after_string);
  13. }
  14.  
  15. sub 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.  
  26. 1;
  27.