doc.SetArray();
BOOST_FOREACH(DNSSECKeeper::keyset_t::value_type value, keyset) {
+ if (req->path_parameters.count("key_id")) {
+ int keyid = lexical_cast<int>(req->path_parameters["key_id"]);
+ int curid = lexical_cast<int>(value.second.id);
+ if (keyid != curid)
+ continue;
+ }
Value key;
key.SetObject();
key.AddMember("type", "Cryptokey", doc.GetAllocator());
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 content(value.first.getDNSKEY().getZoneRepresentation().c_str(), doc.GetAllocator());
- key.AddMember("content", content, doc.GetAllocator());
+ if (req->path_parameters.count("key_id")) {
+ Value content(value.first.getDNSKEY().getZoneRepresentation().c_str(), doc.GetAllocator());
+ key.AddMember("content", content, doc.GetAllocator());
+ }
if (value.second.keyOrZone) {
Value dses;
dses.SetArray();
- Value ds;
- ds.SetString(makeDSFromDNSKey(zonename, value.first.getDNSKEY(), 1).getZoneRepresentation().c_str());
+ Value ds(makeDSFromDNSKey(zonename, value.first.getDNSKEY(), 1).getZoneRepresentation().c_str(), doc.GetAllocator());
dses.PushBack(ds, doc.GetAllocator());
- Value ds2;
- ds2.SetString(makeDSFromDNSKey(zonename, value.first.getDNSKEY(), 2).getZoneRepresentation().c_str());
+ Value ds2(makeDSFromDNSKey(zonename, value.first.getDNSKEY(), 2).getZoneRepresentation().c_str(), doc.GetAllocator());
dses.PushBack(ds2, doc.GetAllocator());
try {
- Value ds3;
- ds3.SetString(makeDSFromDNSKey(zonename, value.first.getDNSKEY(), 3).getZoneRepresentation().c_str());
- dses.PushBack(ds3, doc.GetAllocator());
+ Value ds3(makeDSFromDNSKey(zonename, value.first.getDNSKEY(), 3).getZoneRepresentation().c_str(), doc.GetAllocator());
+ dses.PushBack(ds3, doc.GetAllocator());
}
catch(...)
{
}
try {
- Value ds4;
- ds4.SetString(makeDSFromDNSKey(zonename, value.first.getDNSKEY(), 4).getZoneRepresentation().c_str());
- dses.PushBack(ds4, doc.GetAllocator());
+ Value ds4(makeDSFromDNSKey(zonename, value.first.getDNSKEY(), 4).getZoneRepresentation().c_str(), doc.GetAllocator());
+ dses.PushBack(ds4, doc.GetAllocator());
}
catch(...)
{
}
-
key.AddMember("ds", dses, doc.GetAllocator());
}