security: Add a wrapper for export/import information.
Change-Id: I5c226b44573cafdbe8ab7cf1dfe2324f0bc96d54
diff --git a/tests/security/test-keychain.cpp b/tests/security/test-keychain.cpp
index fb8ee23..3e9b4fc 100644
--- a/tests/security/test-keychain.cpp
+++ b/tests/security/test-keychain.cpp
@@ -22,7 +22,9 @@
Name identity(string("/TestKeyChain/ExportIdentity/") + boost::lexical_cast<std::string>(time::now()));
keyChain.createIdentity(identity);
- Block exported = keyChain.exportIdentity(identity, "1234");
+ shared_ptr<SecuredBag> exported = keyChain.exportIdentity(identity, "1234");
+
+ Block block = exported->wireEncode();
Name keyName = keyChain.getDefaultKeyNameForIdentity(identity);
Name certName = keyChain.getDefaultCertificateNameForKey(keyName);
@@ -35,7 +37,9 @@
BOOST_REQUIRE(keyChain.doesKeyExistInTpm(keyName, KEY_CLASS_PUBLIC) == false);
BOOST_REQUIRE(keyChain.doesCertificateExist(certName) == false);
- keyChain.importIdentity(exported, "1234");
+ SecuredBag imported;
+ imported.wireDecode(block);
+ keyChain.importIdentity(imported, "1234");
BOOST_REQUIRE(keyChain.doesIdentityExist(identity));
BOOST_REQUIRE(keyChain.doesPublicKeyExist(keyName));