pike.git / lib / modules / Tools.pmod / X509.pmod

version» Context lines:

pike.git/lib/modules/Tools.pmod/X509.pmod:1:   #pike __REAL_VERSION__      /* -  * $Id: X509.pmod,v 1.16 2001/10/08 05:37:38 per Exp $ +  * $Id: X509.pmod,v 1.17 2003/01/20 17:44:01 nilsson Exp $    *    * Some random functions for creating RFC-2459 style X.509 certificates.    *    */      #if constant(Standards.ASN1.Types.asn1_sequence)      import Standards.ASN1.Types;   import Standards.PKCS;   
pike.git/lib/modules/Tools.pmod/X509.pmod:33:    second->month_day(),    second->hour_no(),    second->minute_no(),    second->second_no()));   }      /* Returns a mapping similar to that returned by gmtime */   mapping parse_time(object asn1)   {    if ((asn1->type_name != "UTCTime") -  || (strlen(asn1->value) != 13)) +  || (sizeof(asn1->value) != 13))    return 0;       sscanf(asn1->value, "%[0-9]s%c", string s, int c); -  if ( (strlen(s) != 12) && (c != 'Z') ) +  if ( (sizeof(s) != 12) && (c != 'Z') )    return 0;       /* NOTE: This relies on pike-0.7 not interpreting leading zeros as    * an octal prefix. */    mapping m = mkmapping( ({ "year", "mon", "mday", "hour", "min", "sec" }),    (array(int)) (s/2));       if (m->year < 50)    m->year += 100;    if ( (m->mon <= 0 ) || (m->mon > 12) )