security: Adding delete methods in KeyChain

Change-Id: I8e3bbbf6e911b43189c510c56118d291f8932df4
diff --git a/tests/test-sec-tpm-file.cpp b/tests/test-sec-tpm-file.cpp
index 5facdf4..fd27ae8 100644
--- a/tests/test-sec-tpm-file.cpp
+++ b/tests/test-sec-tpm-file.cpp
@@ -6,14 +6,6 @@
 
 #if __clang__
 #pragma clang diagnostic ignored "-Wtautological-compare"
-// #pragma clang diagnostic push
-// #pragma clang diagnostic ignored "-Wreorder"
-// #pragma clang diagnostic ignored "-Wunused-variable"
-// #pragma clang diagnostic ignored "-Wunused-function"
-// #elif __GNUC__
-// #pragma GCC diagnostic ignored "-Wreorder"
-// #pragma GCC diagnostic ignored "-Wunused-variable"
-// #pragma GCC diagnostic ignored "-Wunused-function"
 #endif
 
 #include <boost/test/unit_test.hpp>
@@ -27,16 +19,28 @@
 
 BOOST_AUTO_TEST_SUITE(TestSecTpmFile)
 
+BOOST_AUTO_TEST_CASE (Delete)
+{
+  SecTpmFile tpm;
+  
+  Name keyName("/tmp/ksk-123456");
+  tpm.generateKeyPairInTpm(keyName, KEY_TYPE_RSA, 2048);
+  
+  BOOST_REQUIRE_EQUAL(tpm.doesKeyExistInTpm(keyName, KEY_CLASS_PUBLIC), true);
+  BOOST_REQUIRE_EQUAL(tpm.doesKeyExistInTpm(keyName, KEY_CLASS_PRIVATE), true);
+  
+  tpm.deleteKeyPairInTpm(keyName);
+  
+  BOOST_REQUIRE_EQUAL(tpm.doesKeyExistInTpm(keyName, KEY_CLASS_PUBLIC), false);
+  BOOST_REQUIRE_EQUAL(tpm.doesKeyExistInTpm(keyName, KEY_CLASS_PRIVATE), false);
+}
+
 BOOST_AUTO_TEST_CASE (SignVerify)
 {
   SecTpmFile tpm;
 
   Name keyName("/tmp/ksk-123456");
-  try {
-    tpm.generateKeyPairInTpm(keyName, KEY_TYPE_RSA, 2048);
-  }
-  catch(const SecTpm::Error&) {
-  }
+  tpm.generateKeyPairInTpm(keyName, KEY_TYPE_RSA, 2048);
   
   Data data("/tmp/test/1");
   const uint8_t content[] = {0x01, 0x02, 0x03, 0x04};
@@ -59,7 +63,7 @@
     BOOST_REQUIRE_EQUAL(result, true);
   }
 
-  //We should remove the temporary test key, this should be fixed in a later commit which will add delete operation in SecTpm.
+  tpm.deleteKeyPairInTpm(keyName);
 }
 
 BOOST_AUTO_TEST_SUITE_END()