security+util: mark all pimpl unique_ptrs const
Change-Id: I3966c4988dceb49c204e23967ba90729877bddf1
diff --git a/src/security/tpm/back-end-file.hpp b/src/security/tpm/back-end-file.hpp
index db58907..5609cba 100644
--- a/src/security/tpm/back-end-file.hpp
+++ b/src/security/tpm/back-end-file.hpp
@@ -134,7 +134,7 @@
private:
class Impl;
- unique_ptr<Impl> m_impl;
+ const unique_ptr<Impl> m_impl;
};
} // namespace tpm
diff --git a/src/security/tpm/back-end-mem.hpp b/src/security/tpm/back-end-mem.hpp
index 4bfa212..469b466 100644
--- a/src/security/tpm/back-end-mem.hpp
+++ b/src/security/tpm/back-end-mem.hpp
@@ -114,7 +114,7 @@
private:
class Impl;
- unique_ptr<Impl> m_impl;
+ const unique_ptr<Impl> m_impl;
};
} // namespace tpm
diff --git a/src/security/tpm/back-end-osx.hpp b/src/security/tpm/back-end-osx.hpp
index 29465c8..8310984 100644
--- a/src/security/tpm/back-end-osx.hpp
+++ b/src/security/tpm/back-end-osx.hpp
@@ -143,7 +143,7 @@
private:
class Impl;
- unique_ptr<Impl> m_impl;
+ const unique_ptr<Impl> m_impl;
};
} // namespace tpm
diff --git a/src/security/tpm/tpm.cpp b/src/security/tpm/tpm.cpp
index fad73b9..0ed1062 100644
--- a/src/security/tpm/tpm.cpp
+++ b/src/security/tpm/tpm.cpp
@@ -133,13 +133,14 @@
}
ConstBufferPtr
-Tpm::exportPrivateKey(const Name& keyName, const char* pw, size_t pwLen)
+Tpm::exportPrivateKey(const Name& keyName, const char* pw, size_t pwLen) const
{
return m_backEnd->exportKey(keyName, pw, pwLen);
}
bool
-Tpm::importPrivateKey(const Name& keyName, const uint8_t* pkcs8, size_t pkcs8Len, const char* pw, size_t pwLen)
+Tpm::importPrivateKey(const Name& keyName, const uint8_t* pkcs8, size_t pkcs8Len,
+ const char* pw, size_t pwLen)
{
try {
m_backEnd->importKey(keyName, pkcs8, pkcs8Len, pw, pwLen);
diff --git a/src/security/tpm/tpm.hpp b/src/security/tpm/tpm.hpp
index 82ea656..dde9d14 100644
--- a/src/security/tpm/tpm.hpp
+++ b/src/security/tpm/tpm.hpp
@@ -22,11 +22,11 @@
#ifndef NDN_SECURITY_TPM_TPM_HPP
#define NDN_SECURITY_TPM_TPM_HPP
-#include "../../common.hpp"
#include "../security-common.hpp"
#include "../../name.hpp"
#include "../key-params.hpp"
#include "key-handle.hpp"
+
#include <unordered_map>
namespace ndn {
@@ -154,12 +154,6 @@
*/
Tpm(const std::string& scheme, const std::string& location, unique_ptr<BackEnd> impl);
- BackEnd*
- getBackEnd()
- {
- return m_backEnd.get();
- }
-
/**
* @brief Create key for @p identityName according to @p params.
*
@@ -189,7 +183,7 @@
* @throw BackEnd::Error the key does not exist or it cannot be exported.
*/
ConstBufferPtr
- exportPrivateKey(const Name& keyName, const char* pw, size_t pwLen);
+ exportPrivateKey(const Name& keyName, const char* pw, size_t pwLen) const;
/**
* @brief Import a private key.
@@ -231,7 +225,7 @@
mutable std::unordered_map<Name, unique_ptr<KeyHandle>> m_keys;
- unique_ptr<BackEnd> m_backEnd;
+ const unique_ptr<BackEnd> m_backEnd;
friend class v2::KeyChain;
};