]> granicus.if.org Git - pdns/commitdiff
Add dnskey and set the content to actual private data
authorMark Schouten <mark@tuxis.nl>
Mon, 23 Jun 2014 08:10:54 +0000 (10:10 +0200)
committerMark Schouten <mark@tuxis.nl>
Mon, 23 Jun 2014 08:10:54 +0000 (10:10 +0200)
pdns/ws-auth.cc

index 1359ba4e3b9390e034d7f53deed5a29198f05c7e..70238530cb31bbf52c28822f88312f4157520e37 100644 (file)
@@ -511,8 +511,11 @@ static void apiZoneCryptokeys(HttpRequest* req, HttpResponse* resp) {
     key.AddMember("id", value.second.id, doc.GetAllocator());
     key.AddMember("active", value.second.active, doc.GetAllocator());
     key.AddMember("keytype", (value.second.keyOrZone ? "ksk" : "zsk"), doc.GetAllocator());
+    Value dnskey(value.first.getDNSKEY().getZoneRepresentation().c_str(), doc.GetAllocator());
+    key.AddMember("dnskey", dnskey, doc.GetAllocator());
     if (req->path_parameters.count("key_id")) {
-      Value content(value.first.getDNSKEY().getZoneRepresentation().c_str(), doc.GetAllocator());
+      DNSSECPrivateKey dpk=dk.getKeyById(zonename, lexical_cast<int>(req->path_parameters["key_id"]));
+      Value content(dpk.getKey()->convertToISC().c_str(), doc.GetAllocator());
       key.AddMember("content", content, doc.GetAllocator());
     }