security: Pair-up Tpm and Pib in KeyChain
In this commit, we also change the HOME setting for test cases.
Change-Id: I7fa15461555b3519d9d2005c6956c167ed07d66f
Refs: #2242
Refs: #2260
diff --git a/src/security/sec-tpm-file.cpp b/src/security/sec-tpm-file.cpp
index 7d0748d..26862c5 100644
--- a/src/security/sec-tpm-file.cpp
+++ b/src/security/sec-tpm-file.cpp
@@ -44,6 +44,8 @@
using std::ostringstream;
using std::ofstream;
+const std::string SecTpmFile::SCHEME("tpm-file:");
+
class SecTpmFile::Impl
{
public:
@@ -53,7 +55,7 @@
if (dir.empty())
m_keystorePath = boost::filesystem::path(getenv("HOME")) / ".ndn" / "ndnsec-tpm-file";
else
- m_keystorePath = dir;
+ m_keystorePath = boost::filesystem::path(dir) / ".ndn" / "ndnsec-tpm-file";
boost::filesystem::create_directories(m_keystorePath);
}
@@ -95,12 +97,17 @@
};
-SecTpmFile::SecTpmFile(const string& dir)
- : m_impl(new Impl(dir))
+SecTpmFile::SecTpmFile(const string& location)
+ : SecTpm(location)
+ , m_impl(new Impl(location))
, m_inTerminal(false)
{
}
+SecTpmFile::~SecTpmFile()
+{
+}
+
void
SecTpmFile::generateKeyPairInTpm(const Name& keyName, const KeyParams& params)
{
@@ -239,6 +246,12 @@
os.str().size());
}
+std::string
+SecTpmFile::getScheme()
+{
+ return SCHEME;
+}
+
ConstBufferPtr
SecTpmFile::exportPrivateKeyPkcs8FromTpm(const Name& keyName)
{