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

version» Context lines:

pike.git/lib/modules/Standards.pmod/X509.pmod:216:   //!   //! @returns   //! Returns a DER-encoded certificate.   string sign_key(Sequence issuer, Crypto.RSA|Crypto.DSA c, Sequence subject,    int serial, int ttl, array|void extensions)   {    function(string:string) sign;    if( object_program(c) == Crypto.RSA )    {    sign = lambda(string d) { -  return rsa_sign_digest(c, Identifiers.sha1_id, d); +  return rsa_sign_digest(c, Identifiers.sha1_id, Crypto.SHA1.hash(d));    };    }    else if( object_program(c) == Crypto.DSA )    {    sign = c->sign_ssl;    }    else    error("Unhandled cipher %O. Use RSA or DSA.\n", c);       Sequence tbs = make_tbs(issuer, c->pkcs_algorithm_id(Crypto.SHA1),    subject, c->pkcs_public_key(),    Integer(serial), ttl, extensions); -  string digest = Crypto.SHA1.hash(tbs->get_der()); +        return Sequence(({ tbs, c->pkcs_algorithm_id(Crypto.SHA1), -  BitString(sign(digest)) }))->get_der(); +  BitString(sign(tbs->get_der())) }))->get_der();   }      //! Creates a selfsigned certificate, i.e. where issuer and subject   //! are the same entity. This entity is derived from the list of pairs   //! in @[name], which is encoded into an distinguished_name by   //! @[Standards.PKCS.Certificate.build_distinguished_name].   //!   //! @param c   //! The public key cipher used for the certificate, @[Crypto.RSA] or   //! @[Crypto.DSA]. The object should be initialized with (at least)
pike.git/lib/modules/Standards.pmod/X509.pmod:273:   {    if(!serial)    serial = (int)Gmp.mpz(Standards.UUID.make_version1(-1)->encode(), 256);    Sequence dn = Certificate.build_distinguished_name(@name);    return sign_key(dn, c, dn, serial, ttl, extensions);   }      class Verifier {    constant type = "none";    int(0..1) verify(object,string,string); +  optional Crypto.RSA rsa; +  optional Crypto.DSA dsa;   }      protected class RSAVerifier   {    inherit Verifier;    Crypto.RSA rsa;       constant type = "rsa";       protected void create(string key) {