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

version» Context lines:

pike.git/lib/modules/Standards.pmod/X509.pmod:215: Inside #if constant(Crypto.ECC.Curve)
   break;    }    }    if(!curve) return;    DBG("ECC Curve: %O (%O)\n", curve, curve_id);    pkc = curve->ECDSA()->set_public_key(key);    }   }   #endif    + #if constant(Crypto.ECC.Curve25519) + protected class EdDSAVerifier + { +  inherit Verifier; +  constant type = "eddsa"; +  +  protected void create(string(8bit) key, Identifier curve_id) +  { +  Crypto.ECC.Curve curve; +  foreach(values(Crypto.ECC), mixed c) { +  if (objectp(c) && c->pkcs_eddsa_id && (c->pkcs_eddsa_id() == curve_id)) { +  curve = [object(Crypto.ECC.Curve)]c; +  break; +  } +  } +  if(!curve) return; +  DBG("ECC Edwards Curve: %O (%O)\n", curve, curve_id); +  pkc = curve->EdDSA()->set_public_key(key); +  } + } + #endif +    protected Verifier make_verifier(Object _keyinfo)   {    if( _keyinfo->type_name != "SEQUENCE" )    return NULL("keyinfo isn't a SEQUENCE.\n");    Sequence keyinfo = [object(Sequence)]_keyinfo;       if ( (keyinfo->type_name != "SEQUENCE")    || (sizeof(keyinfo) != 2)    || (keyinfo[0]->type_name != "SEQUENCE")    || !sizeof( [object(Sequence)]keyinfo[0] )
pike.git/lib/modules/Standards.pmod/X509.pmod:271: Inside #if constant(Crypto.ECC.Curve)
   if( sizeof(seq)!=2 || seq[1]->type_name!="OBJECT IDENTIFIER" )    return NULL("Illegal ECDSA ASN.1\n");       Identifier params = seq[1];    Verifier ver = ECDSAVerifier(str->value, params);    if(ver->pkc) return ver;    return NULL("make_verifier: Unsupported ECDSA curve.\n");    }   #endif    + #if constant(Crypto.ECC.Curve25519) +  if((< .PKCS.Identifiers.eddsa25519_id->get_der(), +  .PKCS.Identifiers.eddsa448_id->get_der() >)[seq[0]->get_der()]) +  { +  if( sizeof(seq)!=1 ) +  return NULL("Illegal EdDSA ASN.1\n"); +  +  Verifier ver = EdDSAVerifier(str->value, seq[0]); +  if(ver->pkc) return ver; +  return NULL("make_verifier: Unsupported EdDSA curve.\n"); +  } + #endif +     return NULL("make_verifier: Unknown algorithm identifier: %O\n", seq[0]);   }      protected mapping(int:program(Object)) x509_types = ([    make_combined_tag(2, 1):IssuerId,    make_combined_tag(2, 2):SubjectId,    ]);      //! Represents a TBSCertificate.   //!