]> granicus.if.org Git - pdns/commitdiff
fix up export-zone-key so that we set the algorithm field correctly
authorBert Hubert <bert.hubert@netherlabs.nl>
Thu, 30 Dec 2010 21:45:44 +0000 (21:45 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Thu, 30 Dec 2010 21:45:44 +0000 (21:45 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1777 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/dnsseckeeper.hh
pdns/fsdnsseckeeper.cc
pdns/pdnssec.cc

index 45e5984f3ab22cddccdd1515328e0edb94af9648..5fe0675f9c913cc5c146f59d023a5828bb0a2a8a 100644 (file)
@@ -67,7 +67,7 @@ public:
 
 
   void create(unsigned int bits);
-  std::string convertToISC();
+  std::string convertToISC(unsigned int algorithm);
 
 private:
   rsa_context d_context;
index f1330c26f6891b0e9c5b34ee1234702c4046a20b..80dd61d3be382a311edc50bfcb46a9c133c0dd5d 100644 (file)
@@ -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<pair<string, mpi*> > 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<string>(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
index 042e37ead08442dce5a2b97b3589fc009a2f5ffb..abaf949ba055bde8d924c596f0a0b96ea1e52bba 100644 (file)
@@ -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() <<endl;
+    cout << dpk.d_key.convertToISC(dpk.d_algorithm) <<endl;
   }
   else if(cmds[0]=="export-zone-dnskey") {
     string zone=cmds[1];