security: Adding delete methods in KeyChain
Change-Id: I8e3bbbf6e911b43189c510c56118d291f8932df4
diff --git a/src/security/sec-tpm-file.cpp b/src/security/sec-tpm-file.cpp
index 56f42f8..c8dab80 100644
--- a/src/security/sec-tpm-file.cpp
+++ b/src/security/sec-tpm-file.cpp
@@ -102,6 +102,19 @@
}
}
+void
+SecTpmFile::deleteKeyPairInTpm(const Name &keyName)
+{
+ boost::filesystem::path publicKeyPath(nameTransform(keyName.toUri(), ".pub"));
+ boost::filesystem::path privateKeyPath(nameTransform(keyName.toUri(), ".pri"));
+
+ if(boost::filesystem::exists(publicKeyPath))
+ boost::filesystem::remove(publicKeyPath);
+
+ if(boost::filesystem::exists(privateKeyPath))
+ boost::filesystem::remove(privateKeyPath);
+}
+
ptr_lib::shared_ptr<PublicKey>
SecTpmFile::getPublicKeyFromTpm(const Name & keyName)
{