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.14 2001/08/23 16:18:25 grubba Exp $ +  * $Id: X509.pmod,v 1.15 2001/10/08 04:32:48 per 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;      // Note: Redump this module if you change X509_DEBUG   #ifdef X509_DEBUG   #define X509_WERR werror   #else   #define X509_WERR   #endif      object make_time(int t)   { -  object(Calendar.Second) second = Calendar.Second(t)->set_timezone("UTC"); +  Calendar.Second second = Calendar.Second(t)->set_timezone("UTC");    -  if (second->year() >= 2050) { -  throw( ({ "Tools.X509.make_time: " -  "Times later than 2049 not supported yet\n", -  backtrace() }) ); -  } +  if (second->year_no() >= 2050) { +  error( "Tools.X509.make_time: " +  "Times later than 2049 not supported yet\n" );       return asn1_utc(sprintf("%02d%02d%02d%02d%02d%02dZ", -  second->year() % 100, +  second->year_no() % 100,    second->month_no(),    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)   {
pike.git/lib/modules/Tools.pmod/X509.pmod:73:    /* NOTE: Allows for leap seconds */    if ( (m->sec < 0) || (m->sec > 60))    return 0;       return m;   }      int time_compare(mapping t1, mapping t2)   {    foreach( ({ "year", "mon", "mday", "hour", "min", "sec" }), string name) -  { -  if (t1->name < t2->name) +  if (t1[name] < t2[name])    return -1; -  if (t1->name > t2->name) +  else if (t1[name] > t2[name])    return 1; -  } +     return 0;   }         object extension_sequence = meta_explicit(2, 3);   object version_integer = meta_explicit(2, 0);      object rsa_md2_algorithm = asn1_sequence( ({ Identifiers.rsa_md2_id,    asn1_null() }) );