From: Peter van Dijk Date: Thu, 10 Jan 2013 15:35:16 +0000 (+0000) Subject: fix ECDSA from ISCMap in cryptopp driver, thanks Aki Tuomi X-Git-Tag: auth-3.2~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9b9fca6867fa20caa905c35faa3631781e88a743;p=thirdparty%2Fpdns.git fix ECDSA from ISCMap in cryptopp driver, thanks Aki Tuomi git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@3036 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/cryptoppsigners.cc b/pdns/cryptoppsigners.cc index d44255cb17..b83e9f6869 100644 --- a/pdns/cryptoppsigners.cc +++ b/pdns/cryptoppsigners.cc @@ -82,18 +82,26 @@ DNSCryptoKeyEngine::storvector_t CryptoPPECDSADNSCryptoKeyEngine void CryptoPPECDSADNSCryptoKeyEngine::fromISCMap(DNSKEYRecordContent& drc, std::map& stormap ) { + AutoSeededRandomPool prng; privatekey_t* privateKey = new privatekey_t; - const CryptoPP::Integer x; + const CryptoPP::Integer x(reinterpret_cast(stormap["privatekey"].c_str()), BITS/8); // well it should be this long CryptoPP::OID oid=CURVE(); - privateKey->Initialize(oid, x ); + privateKey->Initialize(oid, x); + bool result = privateKey->Validate(prng, 3); + if (!result) { + throw "Cannot load private key - validation failed!"; + } d_key = shared_ptr(privateKey); publickey_t* publicKey = new publickey_t(); d_key->MakePublicKey(*publicKey); d_pubkey = shared_ptr(publicKey); + drc.d_algorithm = atoi(stormap["algorithm"].c_str()); } + template std::string CryptoPPECDSADNSCryptoKeyEngine::getPubKeyHash() const {