22 #ifndef NDN_SECURITY_TPM_TPM_HPP 23 #define NDN_SECURITY_TPM_TPM_HPP 26 #include "../key-params.hpp" 27 #include "../../name.hpp" 29 #include <unordered_map> 63 class Tpm : noncopyable
66 class Error :
public std::runtime_error
71 :
std::runtime_error(what)
114 decrypt(
const uint8_t* buf,
size_t size,
const Name& keyName)
const;
144 unlockTpm(
const char* password,
size_t passwordLength)
const;
154 Tpm(
const std::string& scheme,
const std::string&
location, unique_ptr<BackEnd>
impl);
199 const char* pw,
size_t pwLen);
219 findKey(
const Name& keyName)
const;
222 std::string m_scheme;
223 std::string m_location;
225 mutable std::unordered_map<Name, unique_ptr<KeyHandle>> m_keys;
227 const unique_ptr<BackEnd> m_backEnd;
239 #endif // NDN_SECURITY_TPM_TPM_HPP ConstBufferPtr sign(const uint8_t *buf, size_t size, const Name &keyName, DigestAlgorithm digestAlgorithm) const
Sign blob using the key with name keyName and using the digest digestAlgorithm.
Copyright (c) 2011-2015 Regents of the University of California.
The interface of signing key management.
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
bool hasKey(const Name &keyName) const
Check if a private key exists.
Abstraction of TPM key handle.
Name createKey(const Name &identityName, const KeyParams ¶ms)
Create key for identityName according to params.
ConstBufferPtr getPublicKey(const Name &keyName) const
represents the front-end of TPM
ConstBufferPtr exportPrivateKey(const Name &keyName, const char *pw, size_t pwLen) const
Export a private key.
void clearKeyCache()
Clear the key cache.
bool unlockTpm(const char *password, size_t passwordLength) const
Unlock the TPM.
void setTerminalMode(bool isTerminal) const
Set the terminal mode of the TPM.
Represents an absolute name.
void deleteKey(const Name &keyName)
Delete a key pair with name keyName.
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const std::string & location
std::string getTpmLocator() const
void importPrivateKey(const Name &keyName, const uint8_t *pkcs8, size_t pkcs8Len, const char *pw, size_t pwLen)
Import a private key.
Base class of key parameters.
ConstBufferPtr decrypt(const uint8_t *buf, size_t size, const Name &keyName) const
Decrypt blob using the key with name keyName.
bool isTerminalMode() const
Check if the TPM is in terminal mode.
Error(const std::string &what)
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const std::string unique_ptr< BackEnd > impl
shared_ptr< const Buffer > ConstBufferPtr