From: Bert Hubert Date: Thu, 30 Dec 2010 21:45:44 +0000 (+0000) Subject: fix up export-zone-key so that we set the algorithm field correctly X-Git-Tag: auth-3.0~470 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=339fe7081643e3e0cf05986db2234246f98f2a80;p=pdns fix up export-zone-key so that we set the algorithm field correctly git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1777 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/dnsseckeeper.hh b/pdns/dnsseckeeper.hh index 45e5984f3..5fe0675f9 100644 --- a/pdns/dnsseckeeper.hh +++ b/pdns/dnsseckeeper.hh @@ -67,7 +67,7 @@ public: void create(unsigned int bits); - std::string convertToISC(); + std::string convertToISC(unsigned int algorithm); private: rsa_context d_context; diff --git a/pdns/fsdnsseckeeper.cc b/pdns/fsdnsseckeeper.cc index f1330c26f..80dd61d3b 100644 --- a/pdns/fsdnsseckeeper.cc +++ b/pdns/fsdnsseckeeper.cc @@ -31,7 +31,7 @@ void RSAContext::create(unsigned int bits) throw runtime_error("Key generation failed"); } -std::string RSAContext::convertToISC() +std::string RSAContext::convertToISC(unsigned int algorithm) { string ret; typedef vector > outputs_t; @@ -44,7 +44,7 @@ std::string RSAContext::convertToISC() ("Exponent2",&d_context.DQ) ("Coefficient",&d_context.QP); - ret = "Private-key-format: v1.2\nAlgorithm: 5 (RSASHA1)\n"; + ret = "Private-key-format: v1.2\nAlgorithm: "+lexical_cast(algorithm)+" (RSASHA1)\n"; BOOST_FOREACH(outputs_t::value_type value, outputs) { ret += value.first; @@ -120,7 +120,7 @@ void DNSSECKeeper::addKey(const std::string& name, bool keyOrZone, int algorithm DNSSECPrivateKey dpk; dpk.d_key.create(bits); // for testing, 1024 - string isc = dpk.d_key.convertToISC(); + string isc = dpk.d_key.convertToISC(algorithm); DNSKEYRecordContent drc = dpk.getDNSKEY(); drc.d_flags = 256 + keyOrZone; // KSK drc.d_algorithm = algorithm; // 5 = RSA, we'll add '2' later on for NSEC3 if needed diff --git a/pdns/pdnssec.cc b/pdns/pdnssec.cc index 042e37ead..abaf949ba 100644 --- a/pdns/pdnssec.cc +++ b/pdns/pdnssec.cc @@ -324,7 +324,7 @@ try string zone=cmds[1]; unsigned int id=atoi(cmds[2].c_str()); DNSSECPrivateKey dpk=dk.getKeyById(zone, id); - cout << dpk.d_key.convertToISC() <