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

version» Context lines:

pike.git/lib/modules/Standards.pmod/X509.pmod:180:    extension_sequence(extensions) }) )    : Sequence( ({ serial,    algorithm,    issuer,    validity,    subject,    keyinfo }) ));   }      //! - 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, Crypto.Hash hash, -  string msg, string s) - { -  Sequence digest_info = Sequence( ({ Sequence( ({ hash->asn1_id(), -  Null() }) ), -  OctetString(hash->hash(msg)) }) ); -  return rsa->raw_verify(digest_info->get_der(), Gmp.mpz(s, 256)); - } -  - //! +    //! @param issuer   //! Distinguished name for the issuer.   //! See @[Standards.PKCS.Certificate.build_distinguished_name].   //!   //! @param c   //! RSA or DSA parameters for the issuer.   //! See @[Crypto.RSA] and @[Crypto.DSA].   //!   //! @param subject   //! Distinguished name for the issuer.
pike.git/lib/modules/Standards.pmod/X509.pmod:232:   //!   //! @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, Crypto.SHA1.hash(d)); +  return c->pkcs_sign(d, Crypto.SHA1);    };    }    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),
pike.git/lib/modules/Standards.pmod/X509.pmod:309:    protected void create(string key) {    rsa = RSA.parse_public_key(key);    }       //!    int(0..1) verify(Sequence algorithm, string msg, string signature)    {    if (!rsa) return 0;    Crypto.Hash hash = algorithms[algorithm->get_der()];    if (!hash) return 0; -  return rsa_verify_digest(rsa, hash, msg, signature); +  return rsa->pkcs_verify(msg, hash, signature);    }   }      protected class DSAVerifier   {    inherit Verifier;    Crypto.DSA dsa;       constant type = "dsa";