Line 0
Link Here
|
|
|
1 |
--- pdns/cryptoppsigners.cc (revision 3032) |
2 |
+++ pdns/cryptoppsigners.cc (working copy) |
3 |
@@ -82,18 +82,26 @@ |
4 |
storvect.push_back(make_pair("PrivateKey", string((char*)buffer, sizeof(buffer)))); |
5 |
return storvect; |
6 |
} |
7 |
+ |
8 |
template<class HASHER, class CURVE, int BITS> |
9 |
void CryptoPPECDSADNSCryptoKeyEngine<HASHER,CURVE,BITS>::fromISCMap(DNSKEYRecordContent& drc, std::map<std::string, std::string>& stormap ) |
10 |
{ |
11 |
+ AutoSeededRandomPool prng; |
12 |
privatekey_t* privateKey = new privatekey_t; |
13 |
- const CryptoPP::Integer x; |
14 |
+ const CryptoPP::Integer x(reinterpret_cast<const unsigned char*>(stormap["privatekey"].c_str()), BITS/8); // well it should be this long |
15 |
CryptoPP::OID oid=CURVE(); |
16 |
- privateKey->Initialize(oid, x ); |
17 |
+ privateKey->Initialize(oid, x); |
18 |
+ bool result = privateKey->Validate(prng, 3); |
19 |
+ if (!result) { |
20 |
+ throw "Cannot load private key - validation failed!"; |
21 |
+ } |
22 |
d_key = shared_ptr<privatekey_t>(privateKey); |
23 |
publickey_t* publicKey = new publickey_t(); |
24 |
d_key->MakePublicKey(*publicKey); |
25 |
d_pubkey = shared_ptr<publickey_t>(publicKey); |
26 |
+ drc.d_algorithm = atoi(stormap["algorithm"].c_str()); |
27 |
} |
28 |
+ |
29 |
template<class HASHER, class CURVE, int BITS> |
30 |
std::string CryptoPPECDSADNSCryptoKeyEngine<HASHER,CURVE,BITS>::getPubKeyHash() const |
31 |
{ |