diff --git a/tests/unit-tests/security/test-conf-checker.cpp b/tests/unit-tests/security/test-conf-checker.cpp
index 23df0cd..f173436 100644
--- a/tests/unit-tests/security/test-conf-checker.cpp
+++ b/tests/unit-tests/security/test-conf-checker.cpp
@@ -21,11 +21,12 @@
 
 #include "security/conf/checker.hpp"
 #include "security/key-chain.hpp"
+#include "identity-management-fixture.hpp"
 #include "boost-test.hpp"
 
 namespace ndn {
 
-BOOST_AUTO_TEST_SUITE(SecurityTestConfChecker)
+BOOST_FIXTURE_TEST_SUITE(SecurityTestConfChecker, security::IdentityManagementFixture)
 
 void
 interestChecked(const shared_ptr<const Interest>& interest)
@@ -88,26 +89,26 @@
   using security::conf::KeyLocatorChecker;
   using security::conf::RelationKeyLocatorNameChecker;
 
-  KeyChain keyChain("sqlite3", "file");
-
   Name identity("/SecurityTestConfChecker/CustomizedCheckerTest1");
-  Name certName = keyChain.createIdentity(identity);
+  BOOST_REQUIRE(addIdentity(identity, RsaKeyParams()));
+  Name certName = m_keyChain.getDefaultCertificateNameForIdentity(identity);
 
   Name identity2("/SecurityTestConfChecker/CustomizedCheckerTest1Wrong");
-  Name certName2 = keyChain.createIdentity(identity2);
+  BOOST_REQUIRE(addIdentity(identity2, RsaKeyParams()));
+  Name certName2 = m_keyChain.getDefaultCertificateNameForIdentity(identity2);
 
   Name packetName("/SecurityTestConfChecker/CustomizedCheckerTest1/Data");
   shared_ptr<Data> data1 = make_shared<Data>(packetName);
-  keyChain.signByIdentity(*data1, identity);
+  m_keyChain.signByIdentity(*data1, identity);
 
   shared_ptr<Data> data2 = make_shared<Data>(packetName);
-  keyChain.signByIdentity(*data2, identity2);
+  m_keyChain.signByIdentity(*data2, identity2);
 
   shared_ptr<Interest> interest1 = make_shared<Interest>(packetName);
-  keyChain.signByIdentity(*interest1, identity);
+  m_keyChain.signByIdentity(*interest1, identity);
 
   shared_ptr<Interest> interest2 = make_shared<Interest>(packetName);
-  keyChain.signByIdentity(*interest2, identity2);
+  m_keyChain.signByIdentity(*interest2, identity2);
 
   int8_t result = 0;
 
@@ -215,10 +216,6 @@
                           bind(dataCheckedFalse, _1),
                           bind(dataCheckFailedFalse, _1, _2));
   BOOST_CHECK_EQUAL(result, -1);
-
-
-  keyChain.deleteIdentity(identity);
-  keyChain.deleteIdentity(identity2);
 }
 
 BOOST_AUTO_TEST_CASE(CustomizedCheckerTest2)
@@ -227,26 +224,26 @@
   using security::conf::KeyLocatorChecker;
   using security::conf::RegexKeyLocatorNameChecker;
 
-  KeyChain keyChain("sqlite3", "file");
-
   Name identity("/SecurityTestConfChecker/CustomizedCheckerTest2");
-  Name certName = keyChain.createIdentity(identity);
+  BOOST_REQUIRE(addIdentity(identity, RsaKeyParams()));
+  Name certName = m_keyChain.getDefaultCertificateNameForIdentity(identity);
 
   Name identity2("/SecurityTestConfChecker/CustomizedCheckerTest2Wrong");
-  Name certName2 = keyChain.createIdentity(identity2);
+  BOOST_REQUIRE(addIdentity(identity2, RsaKeyParams()));
+  Name certName2 = m_keyChain.getDefaultCertificateNameForIdentity(identity2);
 
   Name packetName("/SecurityTestConfChecker/CustomizedCheckerTest2/Data");
   shared_ptr<Data> data1 = make_shared<Data>(packetName);
-  keyChain.signByIdentity(*data1, identity);
+  m_keyChain.signByIdentity(*data1, identity);
 
   shared_ptr<Data> data2 = make_shared<Data>(packetName);
-  keyChain.signByIdentity(*data2, identity2);
+  m_keyChain.signByIdentity(*data2, identity2);
 
   shared_ptr<Interest> interest1 = make_shared<Interest>(packetName);
-  keyChain.signByIdentity(*interest1, identity);
+  m_keyChain.signByIdentity(*interest1, identity);
 
   shared_ptr<Interest> interest2 = make_shared<Interest>(packetName);
-  keyChain.signByIdentity(*interest2, identity2);
+  m_keyChain.signByIdentity(*interest2, identity2);
 
   int8_t result = 0;
 
@@ -275,9 +272,6 @@
                           bind(interestCheckedFalse, _1),
                           bind(interestCheckFailedFalse, _1, _2));
   BOOST_CHECK_EQUAL(result, -1);
-
-  keyChain.deleteIdentity(identity);
-  keyChain.deleteIdentity(identity2);
 }
 
 BOOST_AUTO_TEST_CASE(CustomizedCheckerTest3)
@@ -286,28 +280,26 @@
   using security::conf::KeyLocatorChecker;
   using security::conf::RegexKeyLocatorNameChecker;
 
-  KeyChain keyChain("sqlite3", "file");
-
-  EcdsaKeyParams params;
-
   Name identity("/SecurityTestConfChecker/CustomizedCheckerTest3");
-  Name certName = keyChain.createIdentity(identity, params);
+  BOOST_REQUIRE(addIdentity(identity, EcdsaKeyParams()));
+  Name certName = m_keyChain.getDefaultCertificateNameForIdentity(identity);
 
   Name identity2("/SecurityTestConfChecker/CustomizedCheckerTest3Wrong");
-  Name certName2 = keyChain.createIdentity(identity2, params);
+  BOOST_REQUIRE(addIdentity(identity2, EcdsaKeyParams()));
+  Name certName2 = m_keyChain.getDefaultCertificateNameForIdentity(identity2);
 
   Name packetName("/SecurityTestConfChecker/CustomizedCheckerTest3/Data");
   shared_ptr<Data> data1 = make_shared<Data>(packetName);
-  keyChain.signByIdentity(*data1, identity);
+  m_keyChain.signByIdentity(*data1, identity);
 
   shared_ptr<Data> data2 = make_shared<Data>(packetName);
-  keyChain.signByIdentity(*data2, identity2);
+  m_keyChain.signByIdentity(*data2, identity2);
 
   shared_ptr<Interest> interest1 = make_shared<Interest>(packetName);
-  keyChain.signByIdentity(*interest1, identity);
+  m_keyChain.signByIdentity(*interest1, identity);
 
   shared_ptr<Interest> interest2 = make_shared<Interest>(packetName);
-  keyChain.signByIdentity(*interest2, identity2);
+  m_keyChain.signByIdentity(*interest2, identity2);
 
   int8_t result = 0;
 
@@ -344,47 +336,41 @@
                           bind(dataCheckedFalse, _1),
                           bind(dataCheckFailedFalse, _1, _2));
   BOOST_CHECK_EQUAL(result, -1);
-
-
-  keyChain.deleteIdentity(identity);
-  keyChain.deleteIdentity(identity2);
 }
 
 BOOST_AUTO_TEST_CASE(HierarchicalCheckerTest1)
 {
   using security::conf::HierarchicalChecker;
 
-  KeyChain keyChain("sqlite3", "file");
-
-  EcdsaKeyParams params;
-
   Name identity("/SecurityTestConfChecker/HierarchicalCheckerTest1");
-  Name certName = keyChain.createIdentity(identity, params);
+  BOOST_REQUIRE(addIdentity(identity, EcdsaKeyParams()));
+  Name certName = m_keyChain.getDefaultCertificateNameForIdentity(identity);
 
   Name identity2("/SecurityTestConfChecker/HierarchicalCheckerTest1/Data");
-  Name certName2 = keyChain.createIdentity(identity2);
+  BOOST_REQUIRE(addIdentity(identity2, RsaKeyParams()));
+  Name certName2 = m_keyChain.getDefaultCertificateNameForIdentity(identity2);
 
   Name packetName("/SecurityTestConfChecker/HierarchicalCheckerTest1/Data");
   Name packetName2("/SecurityTestConfChecker");
   Name packetName3("/SecurityTestConfChecker/HierarchicalCheckerTest1");
 
   shared_ptr<Data> data1 = make_shared<Data>(packetName);
-  keyChain.signByIdentity(*data1, identity);
+  m_keyChain.signByIdentity(*data1, identity);
 
   shared_ptr<Data> data2 = make_shared<Data>(packetName2);
-  keyChain.signByIdentity(*data2, identity);
+  m_keyChain.signByIdentity(*data2, identity);
 
   shared_ptr<Data> data3 = make_shared<Data>(packetName3);
-  keyChain.signByIdentity(*data3, identity);
+  m_keyChain.signByIdentity(*data3, identity);
 
   shared_ptr<Data> data4 = make_shared<Data>(packetName);
-  keyChain.signByIdentity(*data4, identity2);
+  m_keyChain.signByIdentity(*data4, identity2);
 
   shared_ptr<Data> data5 = make_shared<Data>(packetName2);
-  keyChain.signByIdentity(*data5, identity2);
+  m_keyChain.signByIdentity(*data5, identity2);
 
   shared_ptr<Data> data6 = make_shared<Data>(packetName3);
-  keyChain.signByIdentity(*data6, identity2);
+  m_keyChain.signByIdentity(*data6, identity2);
 
   int8_t result = 0;
 
@@ -452,35 +438,29 @@
                           bind(dataCheckedFalse, _1),
                           bind(dataCheckFailedFalse, _1, _2));
   BOOST_CHECK_EQUAL(result, -1);
-
-
-  keyChain.deleteIdentity(identity);
-  keyChain.deleteIdentity(identity2);
 }
 
 BOOST_AUTO_TEST_CASE(FixedSignerCheckerTest1)
 {
   using security::conf::FixedSignerChecker;
 
-  KeyChain keyChain("sqlite3", "file");
-
-  EcdsaKeyParams params;
-
   Name identity("/SecurityTestConfChecker/FixedSignerCheckerTest1");
-  Name certName = keyChain.createIdentity(identity, params);
-  shared_ptr<IdentityCertificate> cert1 = keyChain.getCertificate(certName);
+  BOOST_REQUIRE(addIdentity(identity, EcdsaKeyParams()));
+  Name certName = m_keyChain.getDefaultCertificateNameForIdentity(identity);
+  shared_ptr<IdentityCertificate> cert1 = m_keyChain.getCertificate(certName);
 
   Name identity2("/SecurityTestConfChecker/FixedSignerCheckerTest1Wrong");
-  Name certName2 = keyChain.createIdentity(identity2);
-  shared_ptr<IdentityCertificate> cert2 = keyChain.getCertificate(certName2);
+  BOOST_REQUIRE(addIdentity(identity2, RsaKeyParams()));
+  Name certName2 = m_keyChain.getDefaultCertificateNameForIdentity(identity2);
+  shared_ptr<IdentityCertificate> cert2 = m_keyChain.getCertificate(certName2);
 
   Name packetName("/Test/Data");
 
   shared_ptr<Data> data1 = make_shared<Data>(packetName);
-  keyChain.signByIdentity(*data1, identity);
+  m_keyChain.signByIdentity(*data1, identity);
 
   shared_ptr<Data> data2 = make_shared<Data>(packetName);
-  keyChain.signByIdentity(*data2, identity2);
+  m_keyChain.signByIdentity(*data2, identity2);
 
   std::vector<shared_ptr<IdentityCertificate> > certSet1;
   certSet1.push_back(cert1);
@@ -541,10 +521,6 @@
                           bind(dataChecked, _1),
                           bind(dataCheckFailed, _1, _2));
   BOOST_CHECK_EQUAL(result, 1);
-
-
-  keyChain.deleteIdentity(identity);
-  keyChain.deleteIdentity(identity2);
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/unit-tests/security/test-sec-rule.cpp b/tests/unit-tests/security/test-sec-rule.cpp
index 8686b2d..91f9b09 100644
--- a/tests/unit-tests/security/test-sec-rule.cpp
+++ b/tests/unit-tests/security/test-sec-rule.cpp
@@ -22,29 +22,28 @@
 #include "security/sec-rule-specific.hpp"
 #include "security/sec-rule-relative.hpp"
 #include "security/key-chain.hpp"
+#include "identity-management-fixture.hpp"
 
 #include "boost-test.hpp"
 
 namespace ndn {
 
-BOOST_AUTO_TEST_SUITE(SecurityTestSecRule)
+BOOST_FIXTURE_TEST_SUITE(SecurityTestSecRule, security::IdentityManagementFixture)
 
 BOOST_AUTO_TEST_CASE(SecRuleSpecificTest)
 {
-  KeyChain keyChain("sqlite3", "file");
-
   Name rsaIdentity("/SecurityTestSecRule/Basic/Rsa");
-  keyChain.createIdentity(rsaIdentity);
+  BOOST_REQUIRE(addIdentity(rsaIdentity, RsaKeyParams()));
   Name ecdsaIdentity("/SecurityTestSecRule/Basic/Ecdsa");
-  keyChain.createIdentity(ecdsaIdentity);
+  BOOST_REQUIRE(addIdentity(ecdsaIdentity, EcdsaKeyParams()));
 
   Name dataName("SecurityTestSecRule/Basic");
   Data rsaData(dataName);
-  keyChain.signByIdentity(rsaData, rsaIdentity);
+  m_keyChain.signByIdentity(rsaData, rsaIdentity);
   Data ecdsaData(dataName);
-  keyChain.signByIdentity(ecdsaData, ecdsaIdentity);
+  m_keyChain.signByIdentity(ecdsaData, ecdsaIdentity);
   Data sha256Data(dataName);
-  keyChain.signWithSha256(sha256Data);
+  m_keyChain.signWithSha256(sha256Data);
 
   shared_ptr<Regex> dataRegex =
     make_shared<Regex>("^<SecurityTestSecRule><Basic>$");
@@ -59,27 +58,22 @@
   BOOST_CHECK(rule.matchSignerName(rsaData));
   BOOST_CHECK(rule.matchSignerName(ecdsaData));
   BOOST_CHECK_EQUAL(rule.matchSignerName(sha256Data), false);
-
-  keyChain.deleteIdentity(rsaIdentity);
-  keyChain.deleteIdentity(ecdsaIdentity);
 }
 
 BOOST_AUTO_TEST_CASE(SecRuleRelativeTest)
 {
-  KeyChain keyChain("sqlite3", "file");
-
   Name rsaIdentity("/SecurityTestSecRule/Basic/Rsa");
-  keyChain.createIdentity(rsaIdentity);
+  BOOST_REQUIRE(addIdentity(rsaIdentity, RsaKeyParams()));
   Name ecdsaIdentity("/SecurityTestSecRule/Basic/Ecdsa");
-  keyChain.createIdentity(ecdsaIdentity);
+  BOOST_REQUIRE(addIdentity(ecdsaIdentity, EcdsaKeyParams()));
 
   Name dataName("SecurityTestSecRule/Basic");
   Data rsaData(dataName);
-  keyChain.signByIdentity(rsaData, rsaIdentity);
+  m_keyChain.signByIdentity(rsaData, rsaIdentity);
   Data ecdsaData(dataName);
-  keyChain.signByIdentity(ecdsaData, ecdsaIdentity);
+  m_keyChain.signByIdentity(ecdsaData, ecdsaIdentity);
   Data sha256Data(dataName);
-  keyChain.signWithSha256(sha256Data);
+  m_keyChain.signWithSha256(sha256Data);
 
   SecRuleRelative rule("^(<SecurityTestSecRule><Basic>)$",
                        "^(<SecurityTestSecRule><Basic>)<><KEY><><>$",
@@ -91,9 +85,6 @@
   BOOST_CHECK(rule.matchSignerName(rsaData));
   BOOST_CHECK(rule.matchSignerName(ecdsaData));
   BOOST_CHECK_EQUAL(rule.matchSignerName(sha256Data), false);
-
-  keyChain.deleteIdentity(rsaIdentity);
-  keyChain.deleteIdentity(ecdsaIdentity);
 }
 
 BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/unit-tests/security/test-signed-interest.cpp b/tests/unit-tests/security/test-signed-interest.cpp
index 7c3084e..0435116 100644
--- a/tests/unit-tests/security/test-signed-interest.cpp
+++ b/tests/unit-tests/security/test-signed-interest.cpp
@@ -21,32 +21,27 @@
 
 #include "security/key-chain.hpp"
 #include "security/validator.hpp"
-
+#include "identity-management-fixture.hpp"
 #include "boost-test.hpp"
 
-using namespace std;
 namespace ndn {
 
-BOOST_AUTO_TEST_SUITE(SecurityTestSignedInterest)
+BOOST_FIXTURE_TEST_SUITE(SecurityTestSignedInterest, security::IdentityManagementFixture)
 
 BOOST_AUTO_TEST_CASE(SignVerifyInterest)
 {
-  BOOST_REQUIRE_NO_THROW(KeyChain("sqlite3", "file"));
-  KeyChain keyChain("sqlite3", "file");
-
   Name identityName("/TestSignedInterest/SignVerify");
   identityName.appendVersion();
-
-  Name certificateName;
-  BOOST_REQUIRE_NO_THROW(certificateName = keyChain.createIdentity(identityName));
+  BOOST_REQUIRE(addIdentity(identityName, RsaKeyParams()));
+  Name certificateName = m_keyChain.getDefaultCertificateNameForIdentity(identityName);
 
   Interest interest("/TestSignedInterest/SignVerify/Interest1");
-  BOOST_CHECK_NO_THROW(keyChain.signByIdentity(interest, identityName));
+  BOOST_CHECK_NO_THROW(m_keyChain.signByIdentity(interest, identityName));
 
   usleep(100000);
 
   Interest interest11("/TestSignedInterest/SignVerify/Interest1");
-  BOOST_CHECK_NO_THROW(keyChain.signByIdentity(interest11, identityName));
+  BOOST_CHECK_NO_THROW(m_keyChain.signByIdentity(interest11, identityName));
 
   time::system_clock::TimePoint timestamp1 =
     time::fromUnixTimestamp(
@@ -68,18 +63,13 @@
   interest2.wireDecode(interestBlock);
 
   shared_ptr<PublicKey> publicKey;
-  BOOST_REQUIRE_NO_THROW(publicKey = keyChain.getPublicKeyFromTpm(
-    keyChain.getDefaultKeyNameForIdentity(identityName)));
+  BOOST_REQUIRE_NO_THROW(publicKey = m_keyChain.getPublicKeyFromTpm(
+    m_keyChain.getDefaultKeyNameForIdentity(identityName)));
   bool result = Validator::verifySignature(interest2, *publicKey);
 
   BOOST_CHECK_EQUAL(result, true);
-
-  keyChain.deleteIdentity(identityName);
 }
 
-
-
-
 BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace ndn
diff --git a/tests/unit-tests/security/test-validator.cpp b/tests/unit-tests/security/test-validator.cpp
index f917ae7..46bc6a3 100644
--- a/tests/unit-tests/security/test-validator.cpp
+++ b/tests/unit-tests/security/test-validator.cpp
@@ -22,14 +22,14 @@
 #include "security/validator-null.hpp"
 #include "security/key-chain.hpp"
 #include "util/time.hpp"
-
+#include "identity-management-fixture.hpp"
 #include "boost-test.hpp"
 
 namespace ndn {
 
 using std::string;
 
-BOOST_AUTO_TEST_SUITE(SecurityTestValidator)
+BOOST_FIXTURE_TEST_SUITE(SecurityTestValidator, security::IdentityManagementFixture)
 
 void
 onValidated(const shared_ptr<const Data>& data)
@@ -45,19 +45,15 @@
 
 BOOST_AUTO_TEST_CASE(Null)
 {
-  BOOST_REQUIRE_NO_THROW(KeyChain("sqlite3", "file"));
-  KeyChain keyChain("sqlite3", "file");
-
   Name identity("/TestValidator/Null");
   identity.appendVersion();
-
-  BOOST_REQUIRE_NO_THROW(keyChain.createIdentity(identity));
+  BOOST_REQUIRE(addIdentity(identity, RsaKeyParams()));
 
   Name dataName = identity;
   dataName.append("1");
   shared_ptr<Data> data = make_shared<Data>(dataName);
 
-  BOOST_CHECK_NO_THROW(keyChain.signByIdentity(*data, identity));
+  BOOST_CHECK_NO_THROW(m_keyChain.signByIdentity(*data, identity));
 
   ValidatorNull validator;
 
@@ -65,8 +61,6 @@
   validator.validate(*data,
                      bind(&onValidated, _1),
                      bind(&onValidationFailed, _1, _2));
-
-  keyChain.deleteIdentity(identity);
 }
 
 const uint8_t ecdsaSigInfo[] = {
@@ -94,27 +88,23 @@
 
 BOOST_AUTO_TEST_CASE(RsaSignatureVerification)
 {
-  BOOST_REQUIRE_NO_THROW(KeyChain("sqlite3", "file"));
-  KeyChain keyChain("sqlite3", "file");
-
   Name identity("/TestValidator/RsaSignatureVerification");
-  BOOST_REQUIRE_NO_THROW(keyChain.createIdentity(identity));
-  Name keyName = keyChain.getDefaultKeyNameForIdentity(identity);
-  shared_ptr<PublicKey> publicKey = keyChain.getPublicKey(keyName);
+  BOOST_REQUIRE(addIdentity(identity, RsaKeyParams()));
+  Name keyName = m_keyChain.getDefaultKeyNameForIdentity(identity);
+  shared_ptr<PublicKey> publicKey = m_keyChain.getPublicKey(keyName);
 
   Name identity2("/TestValidator/RsaSignatureVerification/id2");
-  BOOST_REQUIRE_NO_THROW(keyChain.createIdentity(identity2));
-  Name keyName2 = keyChain.getDefaultKeyNameForIdentity(identity2);
-  shared_ptr<PublicKey> publicKey2 = keyChain.getPublicKey(keyName2);
-
+  BOOST_REQUIRE(addIdentity(identity2, RsaKeyParams()));
+  Name keyName2 = m_keyChain.getDefaultKeyNameForIdentity(identity2);
+  shared_ptr<PublicKey> publicKey2 = m_keyChain.getPublicKey(keyName2);
 
   Data data("/TestData/1");
-  BOOST_CHECK_NO_THROW(keyChain.signByIdentity(data, identity));
+  BOOST_CHECK_NO_THROW(m_keyChain.signByIdentity(data, identity));
   BOOST_CHECK_EQUAL(Validator::verifySignature(data, *publicKey), true);
   BOOST_CHECK_EQUAL(Validator::verifySignature(data, *publicKey2), false);
 
   Interest interest("/TestInterest/1");
-  BOOST_CHECK_NO_THROW(keyChain.signByIdentity(interest, identity));
+  BOOST_CHECK_NO_THROW(m_keyChain.signByIdentity(interest, identity));
   BOOST_CHECK_EQUAL(Validator::verifySignature(interest, *publicKey), true);
   BOOST_CHECK_EQUAL(Validator::verifySignature(interest, *publicKey2), false);
 
@@ -124,9 +114,6 @@
   Signature ecdsaSig(ecdsaSigInfoBlock, ecdsaSigValueBlock);
   wrongData.setSignature(ecdsaSig);
   BOOST_CHECK_EQUAL(Validator::verifySignature(wrongData, *publicKey), false);
-
-  keyChain.deleteIdentity(identity);
-  keyChain.deleteIdentity(identity2);
 }
 
 const uint8_t rsaSigInfo[] = {
@@ -160,36 +147,24 @@
 
 BOOST_AUTO_TEST_CASE(EcdsaSignatureVerification)
 {
-  BOOST_REQUIRE_NO_THROW(KeyChain("sqlite3", "file"));
-  KeyChain keyChain("sqlite3", "file");
-
   Name identity("/TestValidator/EcdsaSignatureVerification");
-  EcdsaKeyParams params;
-  // BOOST_REQUIRE_NO_THROW(keyChain.createIdentity(identity, params));
-  try
-    {
-      keyChain.createIdentity(identity, params);
-    }
-  catch (std::runtime_error& e)
-    {
-      std::cerr << e.what() << std::endl;
-    }
-  Name keyName = keyChain.getDefaultKeyNameForIdentity(identity);
-  shared_ptr<PublicKey> publicKey = keyChain.getPublicKey(keyName);
+  BOOST_REQUIRE(addIdentity(identity, EcdsaKeyParams()));
+  Name keyName = m_keyChain.getDefaultKeyNameForIdentity(identity);
+  shared_ptr<PublicKey> publicKey = m_keyChain.getPublicKey(keyName);
 
   Name identity2("/TestValidator/EcdsaSignatureVerification/id2");
-  BOOST_REQUIRE_NO_THROW(keyChain.createIdentity(identity2, params));
-  Name keyName2 = keyChain.getDefaultKeyNameForIdentity(identity2);
-  shared_ptr<PublicKey> publicKey2 = keyChain.getPublicKey(keyName2);
+  BOOST_REQUIRE(addIdentity(identity2, EcdsaKeyParams()));
+  Name keyName2 = m_keyChain.getDefaultKeyNameForIdentity(identity2);
+  shared_ptr<PublicKey> publicKey2 = m_keyChain.getPublicKey(keyName2);
 
 
   Data data("/TestData/1");
-  BOOST_CHECK_NO_THROW(keyChain.signByIdentity(data, identity));
+  BOOST_CHECK_NO_THROW(m_keyChain.signByIdentity(data, identity));
   BOOST_CHECK_EQUAL(Validator::verifySignature(data, *publicKey), true);
   BOOST_CHECK_EQUAL(Validator::verifySignature(data, *publicKey2), false);
 
   Interest interest("/TestInterest/1");
-  BOOST_CHECK_NO_THROW(keyChain.signByIdentity(interest, identity));
+  BOOST_CHECK_NO_THROW(m_keyChain.signByIdentity(interest, identity));
   BOOST_CHECK_EQUAL(Validator::verifySignature(interest, *publicKey), true);
   BOOST_CHECK_EQUAL(Validator::verifySignature(interest, *publicKey2), false);
 
@@ -199,35 +174,30 @@
   Signature rsaSig(rsaSigInfoBlock, rsaSigValueBlock);
   wrongData.setSignature(rsaSig);
   BOOST_CHECK_EQUAL(Validator::verifySignature(wrongData, *publicKey), false);
-
-  keyChain.deleteIdentity(identity);
-  keyChain.deleteIdentity(identity2);
 }
 
 BOOST_AUTO_TEST_CASE(EcdsaSignatureVerification2)
 {
-  KeyChain keyChain("sqlite3", "file");
-
-  EcdsaKeyParams params;
-
   Name ecdsaIdentity("/SecurityTestValidator/EcdsaSignatureVerification2/ecdsa");
-  Name ecdsaCertName = keyChain.createIdentity(ecdsaIdentity, params);
-  shared_ptr<IdentityCertificate> ecdsaCert = keyChain.getCertificate(ecdsaCertName);
+  BOOST_REQUIRE(addIdentity(ecdsaIdentity, EcdsaKeyParams()));
+  Name ecdsaCertName = m_keyChain.getDefaultCertificateNameForIdentity(ecdsaIdentity);
+  shared_ptr<IdentityCertificate> ecdsaCert = m_keyChain.getCertificate(ecdsaCertName);
 
   Name rsaIdentity("/SecurityTestValidator/EcdsaSignatureVerification2/rsa");
-  Name rsaCertName = keyChain.createIdentity(rsaIdentity);
-  shared_ptr<IdentityCertificate> rsaCert = keyChain.getCertificate(rsaCertName);
+  BOOST_REQUIRE(addIdentity(rsaIdentity, RsaKeyParams()));
+  Name rsaCertName = m_keyChain.getDefaultCertificateNameForIdentity(rsaIdentity);
+  shared_ptr<IdentityCertificate> rsaCert = m_keyChain.getCertificate(rsaCertName);
 
   Name packetName("/Test/Packet/Name");
 
   shared_ptr<Data> testDataRsa = make_shared<Data>(packetName);
-  keyChain.signByIdentity(*testDataRsa, rsaIdentity);
+  m_keyChain.signByIdentity(*testDataRsa, rsaIdentity);
   shared_ptr<Data> testDataEcdsa = make_shared<Data>(packetName);
-  keyChain.signByIdentity(*testDataEcdsa, ecdsaIdentity);
+  m_keyChain.signByIdentity(*testDataEcdsa, ecdsaIdentity);
   shared_ptr<Interest> testInterestRsa = make_shared<Interest>(packetName);
-  keyChain.signByIdentity(*testInterestRsa, rsaIdentity);
+  m_keyChain.signByIdentity(*testInterestRsa, rsaIdentity);
   shared_ptr<Interest> testInterestEcdsa = make_shared<Interest>(packetName);
-  keyChain.signByIdentity(*testInterestEcdsa, ecdsaIdentity);
+  m_keyChain.signByIdentity(*testInterestEcdsa, ecdsaIdentity);
 
   BOOST_CHECK(Validator::verifySignature(*ecdsaCert, ecdsaCert->getPublicKeyInfo()));
   BOOST_CHECK_EQUAL(Validator::verifySignature(*ecdsaCert, rsaCert->getPublicKeyInfo()), false);
@@ -245,9 +215,6 @@
   BOOST_CHECK_EQUAL(Validator::verifySignature(*testInterestRsa, ecdsaCert->getPublicKeyInfo()),
                     false);
   BOOST_CHECK(Validator::verifySignature(*testInterestRsa, rsaCert->getPublicKeyInfo()));
-
-  keyChain.deleteIdentity(ecdsaIdentity);
-  keyChain.deleteIdentity(rsaIdentity);
 }
 
 BOOST_AUTO_TEST_SUITE_END()
