22 #ifndef NDN_SECURITY_TPM_TPM_HPP
23 #define NDN_SECURITY_TPM_TPM_HPP
25 #include "../../common.hpp"
26 #include "../security-common.hpp"
27 #include "../../name.hpp"
28 #include "../key-params.hpp"
30 #include <unordered_map>
64 class Tpm : noncopyable
67 class Error :
public std::runtime_error
72 :
std::runtime_error(what)
115 decrypt(
const uint8_t* buf,
size_t size,
const Name& keyName)
const;
145 unlockTpm(
const char* password,
size_t passwordLength)
const;
155 Tpm(
const std::string& scheme,
const std::string& location, unique_ptr<BackEnd> impl);
160 return m_backEnd.get();
172 createKey(
const Name& identityName,
const KeyParams& params);
178 deleteKey(
const Name& keyName);
191 exportPrivateKey(
const Name& keyName,
const char* pw,
size_t pwLen);
204 importPrivateKey(
const Name& keyName,
205 const uint8_t* pkcs8,
size_t pkcs8Len,
206 const char* pw,
size_t pwLen);
226 findKey(
const Name& keyName)
const;
229 std::string m_scheme;
230 std::string m_location;
232 mutable std::unordered_map<Name, unique_ptr<KeyHandle>> m_keys;
234 unique_ptr<BackEnd> m_backEnd;
246 #endif // NDN_SECURITY_TPM_TPM_HPP
Copyright (c) 2013-2016 Regents of the University of California.
std::string getTpmLocator() const
The interface of signing key management.
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
ConstBufferPtr sign(const uint8_t *buf, size_t size, const Name &keyName, DigestAlgorithm digestAlgorithm) const
Sign blob using key with name keyName with digest digestAlgorithm.
represents the front-end of TPM
Abstraction of Tpm back-end.
bool isTerminalMode() const
Check if TPM is in terminal mode.
bool hasKey(const Name &keyName) const
Check if a private key exist.
bool unlockTpm(const char *password, size_t passwordLength) const
Unlock TPM.
Name abstraction to represent an absolute name.
ConstBufferPtr getPublicKey(const Name &keyName) const
void setTerminalMode(bool isTerminal) const
Set the terminal mode of TPM.
ConstBufferPtr decrypt(const uint8_t *buf, size_t size, const Name &keyName) const
Decrypt blob using key with name keyName.
Base class of key parameters.
shared_ptr< const Buffer > ConstBufferPtr
Error(const std::string &what)