Skip to content

Commit

Permalink
Merge pull request #7516 from Habbie/fromiscfile-errors
Browse files Browse the repository at this point in the history
report checkKey errors upwards in makeFromISCFile exception
  • Loading branch information
rgacogne committed Mar 5, 2019
2 parents 9fa4d40 + be135ee commit b0f70f2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pdns/dnssecinfra.cc
Expand Up @@ -63,8 +63,14 @@ shared_ptr<DNSCryptoKeyEngine> DNSCryptoKeyEngine::makeFromISCFile(DNSKEYRecordC
fp.reset();

shared_ptr<DNSCryptoKeyEngine> dke = makeFromISCString(drc, isc);
if(!dke->checkKey()) {
throw runtime_error("Invalid DNS Private Key in file '"+string(fname));
vector<string> checkKeyErrors;

if(!dke->checkKey(&checkKeyErrors)) {
string reason;
if(checkKeyErrors.size()) {
reason = " ("+boost::algorithm::join(checkKeyErrors, ", ")+")";
}
throw runtime_error("Invalid DNS Private Key in file '"+string(fname)+"'"+reason);
}
return dke;
}
Expand Down

0 comments on commit b0f70f2

Please sign in to comment.