security: Add helpers for Command Interest
refs: #1238
Change-Id: I5a42f888b83bcc6dc51ea02045e438a4905ed145
diff --git a/src/security/key-chain.hpp b/src/security/key-chain.hpp
index e79b9c2..86589eb 100644
--- a/src/security/key-chain.hpp
+++ b/src/security/key-chain.hpp
@@ -201,7 +201,7 @@
void
sign(Data& data, const Name& certificateName)
{
- ptr_lib::shared_ptr<IdentityCertificate> cert = Info::getCertificate(certificateName);
+ shared_ptr<IdentityCertificate> cert = Info::getCertificate(certificateName);
if (!cert)
throw InfoError("Requested certificate [" + certificateName.toUri() + "] doesn't exist");
@@ -216,14 +216,14 @@
void
sign(Interest &interest, const Name &certificateName)
{
- ptr_lib::shared_ptr<IdentityCertificate> cert = Info::getCertificate(certificateName);
+ shared_ptr<IdentityCertificate> cert = Info::getCertificate(certificateName);
if(!static_cast<bool>(cert))
throw InfoError("Requested certificate [" + certificateName.toUri() + "] doesn't exist");
SignatureSha256WithRsa signature;
signature.setKeyLocator(certificateName.getPrefix(-1)); // implicit conversion should take care
- Name interestName = interest.getName().append(Name::Component::fromNumber(getNow())).append(signature.getInfo());
+ Name& interestName = interest.getName().append(signature.getInfo());
signature.setValue(Tpm::signInTpm(interestName.wireEncode().value(),
interestName.wireEncode().value_size(),
@@ -402,8 +402,7 @@
SignatureSha256WithRsa signature;
signature.setKeyLocator(certificate.getName().getPrefix(-1)); // implicit conversion should take care
- Name &interestName = interest.getName();
- interestName.append(Name::Component::fromNumber(getNow())).append(signature.getInfo());
+ Name& interestName = interest.getName().append(signature.getInfo());
signature.setValue(Tpm::signInTpm(interestName.wireEncode().value(),
interestName.wireEncode().value_size(),