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

version» Context lines:

pike.git/lib/modules/Standards.pmod/X509.pmod:289:       constant type = "rsa";       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;    if (algorithm->get_der() == rsa_md5_algorithm->get_der())    return rsa_verify_digest(rsa, Identifiers.md5_id,    Crypto.MD5.hash(msg),    signature);    if (algorithm->get_der() == rsa_sha1_algorithm->get_der())    return rsa_verify_digest(rsa, Identifiers.sha1_id,    Crypto.SHA1.hash(msg),    signature);    if (algorithm->get_der() == rsa_sha256_algorithm->get_der())    return rsa_verify_digest(rsa, Identifiers.sha256_id,
pike.git/lib/modules/Standards.pmod/X509.pmod:337:    {    dsa = DSA.parse_public_key(key, p, q, g);    }       //! Verifies the @[signature] of the certificate @[msg] using the    //! indicated hash @[algorithm]. The signature is the DER-encoded    //! ASN.1 sequence Dss-Sig-Value with the two integers r and s. See    //! RFC 3279 section 2.2.2.    int(0..1) verify(Sequence algorithm, string msg, string signature)    { +  if (!dsa) return 0;    if (algorithm->get_der() == dsa_sha1_algorithm->get_der())    return dsa->verify_ssl(msg, signature);       return 0;    }   }      protected Verifier make_verifier(Object _keyinfo)   {    if( _keyinfo->type_name != "SEQUENCE" )
pike.git/lib/modules/Standards.pmod/X509.pmod:368:    String str = [object(String)]keyinfo[1];       if(sizeof(seq)==0) return 0;       if (seq[0]->get_der() == Identifiers.rsa_id->get_der())    {    if ( (sizeof(seq) != 2)    || (seq[1]->get_der() != Null()->get_der()) )    return 0;    -  // FIXME: Verify that the Verifier is usable. +     return RSAVerifier(str->value);    }       if(seq[0]->get_der() == Identifiers.dsa_id->get_der())    {    if( sizeof(seq)!=2 || seq[1]->type_name!="SEQUENCE" ||    sizeof(seq[1])!=3 || seq[1][0]->type_name!="INTEGER" ||    seq[1][1]->type_name!="INTEGER" || seq[1][2]->type_name!="INTEGER" )    return 0;    -  // FIXME: Verify that the Verifier is usable. +     Sequence params = seq[1];    return DSAVerifier(str->value, params[0]->value,    params[1]->value, params[2]->value); -  return 0; +     }   }      //! Represents a TBSCertificate.   class TBSCertificate   {    //!    string der;       //!