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

version» Context lines:

pike.git/lib/modules/Tools.pmod/X509.pmod:1:   #pike __REAL_VERSION__   //#pragma strict_types      /* -  * $Id: X509.pmod,v 1.25 2004/01/30 10:33:11 nilsson Exp $ +  * $Id: X509.pmod,v 1.26 2004/02/03 13:53:02 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:157:    dn, keyinfo,    serial, ttl, extensions);       return Sequence(    ({ tbs,    signature_algorithm,    BitString(dsa->sign_ssl(tbs->get_der())) }))->get_der();   }      //! - string rsa_sign_digest(Crypto.rsa rsa, object digest_id, string digest) + string rsa_sign_digest(Crypto.RSA rsa, object digest_id, string digest)   {    Sequence digest_info = Sequence( ({ Sequence( ({ digest_id, Null() }) ),    OctetString(digest) }) );    return rsa->raw_sign(digest_info->get_der())->digits(256);   }      //! - int(0..1) rsa_verify_digest(Crypto.rsa rsa, object digest_id, + int(0..1) rsa_verify_digest(Crypto.RSA rsa, object digest_id,    string digest, string s)   {    Sequence digest_info = Sequence( ({ Sequence( ({ digest_id, Null() }) ),    OctetString(digest) }) );    return rsa->raw_verify(digest_info->get_der(), Gmp.mpz(s, 256));   }      //! - string make_selfsigned_rsa_certificate(Crypto.rsa rsa, int ttl, array name, + string make_selfsigned_rsa_certificate(Crypto.RSA rsa, int ttl, array name,    array|void extensions)   {    Integer serial = Integer(1); /* Hard coded serial number */       int now = time();    Sequence validity = Sequence( ({ make_time(now), make_time(now + ttl) }) );       Sequence signature_algorithm = Sequence( ({ Identifiers.rsa_sha1_id,    Null() }) );   
pike.git/lib/modules/Tools.pmod/X509.pmod:212:    Crypto.sha()->update(tbs->get_der())->digest()   #endif    )) }) )->get_der();   }      class Verifier {    constant type = "none";    int(0..1) verify(object,string,string);    this_program init(string key);    -  optional Crypto.rsa rsa; // Ugly +  optional Crypto.RSA rsa; // Ugly   }      //!   class rsa_verifier   {    inherit Verifier; -  Crypto.rsa rsa; +  Crypto.RSA rsa;       constant type = "rsa";       //!    this_program init(string key) {    rsa = RSA.parse_public_key(key);    return rsa && this;    }       //!