security: Add helpers for Command Interest
refs: #1238
Change-Id: I5a42f888b83bcc6dc51ea02045e438a4905ed145
diff --git a/tests/test-signed-interest.cpp b/tests/test-signed-interest.cpp
index a7df556..aef2530 100644
--- a/tests/test-signed-interest.cpp
+++ b/tests/test-signed-interest.cpp
@@ -19,10 +19,11 @@
{
KeyChainImpl<SecPublicInfoSqlite3, SecTpmFile> keyChain;
- Name identityName("/test");
- Name certificateName = keyChain.createIdentity(identityName);
+ Name identityName("/TestSignedInterest/SignVerify");
+ Name certificateName;
+ BOOST_REQUIRE_NO_THROW(certificateName = keyChain.createIdentity(identityName));
- Interest interest("/test/interest");
+ Interest interest("/TestSignedInterest/SignVerify/Interest1");
keyChain.signByIdentity(interest, identityName);
Block interestBlock(interest.wireEncode().wire(), interest.wireEncode().size());
@@ -30,10 +31,12 @@
Interest interest2;
interest2.wireDecode(interestBlock);
- ptr_lib::shared_ptr<PublicKey> publicKey = keyChain.getPublicKeyFromTpm(keyChain.getDefaultKeyNameForIdentity(identityName));
+ shared_ptr<PublicKey> publicKey = keyChain.getPublicKeyFromTpm(keyChain.getDefaultKeyNameForIdentity(identityName));
bool result = Validator::verifySignature(interest2, *publicKey);
- BOOST_REQUIRE_EQUAL(result, true);
+ BOOST_CHECK_EQUAL(result, true);
+
+ BOOST_CHECK_NO_THROW(keyChain.deleteIdentity(identityName));
}
BOOST_AUTO_TEST_SUITE_END()