From: Bert Hubert Date: Mon, 27 Dec 2010 19:25:04 +0000 (+0000) Subject: align our key storage naming with the excellent ldns/nsd/unbound tools, which also... X-Git-Tag: auth-3.0~487 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b31509517a2531df893488d8f27f65f96310ab2a;p=pdns align our key storage naming with the excellent ldns/nsd/unbound tools, which also found a few bugs in our storage git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1760 d19b8d6e-7fed-0310-83ef-9ca221ded41b --- diff --git a/pdns/fsdnsseckeeper.cc b/pdns/fsdnsseckeeper.cc index 2a86f3bc4..90fdd584b 100644 --- a/pdns/fsdnsseckeeper.cc +++ b/pdns/fsdnsseckeeper.cc @@ -37,8 +37,6 @@ std::string RSAContext::convertToISC() typedef vector > outputs_t; outputs_t outputs; push_back(outputs)("Modulus", &d_context.N)("PublicExponent",&d_context.E) - ("Modulus", &d_context.N) - ("PublicExponent",&d_context.E) ("PrivateExponent",&d_context.D) ("Prime1",&d_context.P) ("Prime2",&d_context.Q) @@ -83,7 +81,7 @@ bool DNSSECKeeper::haveActiveKSKFor(const std::string& zone, DNSSECPrivateKey* d ++dir_itr ) { // cerr<<"Entry: '"<< dir_itr->leaf() <<"'"<leaf(),".isc")) { + if(ends_with(dir_itr->leaf(),".private")) { // cerr<<"Hit!"<leaf(),".isc")) { + if(ends_with(dir_itr->leaf(),".private")) { maxID = max(maxID, (unsigned int)atoi(dir_itr->leaf().c_str())); } } @@ -170,32 +168,33 @@ void DNSSECKeeper::addKey(const std::string& name, bool keyOrZone, int algorithm iscName += active ? ".active" : ".passive"; { - ofstream iscFile((iscName+".isc").c_str()); + ofstream iscFile((iscName+".private").c_str()); iscFile << isc; } { - ofstream dnskeyFile((iscName+".dnskey").c_str()); + ofstream dnskeyFile((iscName+".key").c_str()); dnskeyFile << toCanonic("", name) << " IN DNSKEY " << drc.getZoneRepresentation()<leaf() <<"'"<leaf(),".isc")) { + if(ends_with(dir_itr->leaf(),".private")) { DNSSECPrivateKey dpk; getRSAKeyFromISC(&dpk.d_key.getContext(), dir_itr->path().file_string().c_str()); @@ -285,9 +286,7 @@ DNSSECKeeper::keyset_t DNSSECKeeper::getKeys(const std::string& zone, boost::tri &ts1.tm_year, &ts1.tm_mon, &ts1.tm_mday, &ts1.tm_hour, &ts1.tm_min); - ts1.tm_year -= 1900; - ts1.tm_mon--; KeyMetaData kmd; @@ -299,7 +298,7 @@ DNSSECKeeper::keyset_t DNSSECKeeper::getKeys(const std::string& zone, boost::tri if(boost::indeterminate(allOrKeyOrZone) || allOrKeyOrZone == kmd.keyOrZone) keyset.push_back(make_pair(dpk, kmd)); } - sort(keyset.begin(), keyset.end(), zskCompareByID); + sort(keyset.begin(), keyset.end(), keyCompareByKindAndID); } return keyset; @@ -342,12 +341,12 @@ void DNSSECKeeper::secureZone(const std::string& name, int algorithm) { - ofstream iscFile((iscName+".isc").c_str()); + ofstream iscFile((iscName+".private").c_str()); iscFile << isc; } { - ofstream dnskeyFile((iscName+".dnskey").c_str()); + ofstream dnskeyFile((iscName+".key").c_str()); dnskeyFile << toCanonic("", name) << " IN DNSKEY " << drc.getZoneRepresentation()<