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.18 2003/01/26 17:23:54 nilsson Exp $ +  * $Id: X509.pmod,v 1.19 2003/11/30 17:17:24 nilsson Exp $    *    * Some random functions for creating RFC-2459 style X.509 certificates.    *    */      #if constant(Standards.ASN1.Types.Sequence)      import Standards.ASN1.Types;   import Standards.PKCS;   
pike.git/lib/modules/Tools.pmod/X509.pmod:196:    Sequence dn = Certificate.build_distinguished_name(@name);       Sequence tbs = make_tbs(dn, rsa_sha1_algorithm,    dn, keyinfo,    serial, ttl, extensions);       return Sequence(    ({ tbs,    rsa_sha1_algorithm,    BitString(rsa_sign_digest(rsa, Identifiers.sha1_id, -  Crypto.sha()->update(tbs->get_der()) -  ->digest())) }) )->get_der(); + #if constant(Crypto.SHA) +  Crypto.SHA.hash(tbs->get_der()) + #else +  Crypto.sha()->update(tbs->get_der())->digest() + #endif +  )) }) )->get_der();   }      //!   class rsa_verifier   {    object rsa;       constant type = "rsa";       //!
pike.git/lib/modules/Tools.pmod/X509.pmod:219:    {    rsa = RSA.parse_public_key(key);    return rsa && this_object();    }       //!    int verify(object algorithm, string msg, string signature)    {    if (algorithm->get_der() == rsa_md5_algorithm->get_der())    return rsa_verify_digest(rsa, Identifiers.md5_id, + #if constant(Crypto.MD5) +  Crypto.MD5.hash(msg), + #else    Crypto.md5()->update(msg)->digest(), -  + #endif    signature);    if (algorithm->get_der() == rsa_sha1_algorithm->get_der())    return rsa_verify_digest(rsa, Identifiers.sha1_id, -  + #if constant(Crypto.SHA) +  Crypto.SHA.hash(msg), + #else    Crypto.sha()->update(msg)->digest(), -  + #endif    signature);    if (algorithm->get_der() == rsa_md2_algorithm->get_der())    return rsa_verify_digest(rsa, Identifiers.md2_id, -  + #if constant(Crypto.MD2) +  Crypto.MD2.hash(msg), + #else    Crypto.md2()->update(msg)->digest(), -  + #endif    signature);    return 0;    }   }      #if 0   /* FIXME: This is a little more difficult, as the dsa-parameters are    * sometimes taken from the CA, and not present in the keyinfo. */   class dsa_verifier   {