security: include certificate name in KeyLocator
refs #5112
Change-Id: I0066b30ea48d8a51c66630aa186a372280eecd7f
diff --git a/tests/key-chain-fixture.cpp b/tests/key-chain-fixture.cpp
index 73e27c4..af62de5 100644
--- a/tests/key-chain-fixture.cpp
+++ b/tests/key-chain-fixture.cpp
@@ -44,8 +44,11 @@
}
Certificate
-KeyChainFixture::makeCert(const Key& key, const std::string& issuer, const Key& signingKey)
+KeyChainFixture::makeCert(const Key& key, const std::string& issuer, const Key& signingKey,
+ optional<KeyLocator> keyLocator)
{
+ const Key& signer = signingKey ? signingKey : key;
+
Certificate cert;
cert.setName(Name(key.getName())
.append(issuer)
@@ -62,8 +65,11 @@
ndn::SignatureInfo info;
auto now = time::system_clock::now();
info.setValidityPeriod(ValidityPeriod(now - 30_days, now + 30_days));
+ if (keyLocator) {
+ info.setKeyLocator(*keyLocator);
+ }
- m_keyChain.sign(cert, signingByKey(signingKey ? signingKey : key).setSignatureInfo(info));
+ m_keyChain.sign(cert, signingByKey(signer).setSignatureInfo(info));
return cert;
}