22 #ifndef NDN_SECURITY_TPM_TPM_HPP 23 #define NDN_SECURITY_TPM_TPM_HPP 29 #include <unordered_map> 63 class Tpm : noncopyable
66 class Error :
public std::runtime_error
69 using std::runtime_error::runtime_error;
110 decrypt(
const uint8_t* buf,
size_t size,
const Name& keyName)
const;
140 unlockTpm(
const char* password,
size_t passwordLength)
const;
150 Tpm(
const std::string& scheme,
const std::string&
location, unique_ptr<BackEnd>
impl);
195 const char* pw,
size_t pwLen);
215 findKey(
const Name& keyName)
const;
218 std::string m_scheme;
219 std::string m_location;
221 mutable std::unordered_map<Name, unique_ptr<KeyHandle>> m_keys;
223 const unique_ptr<BackEnd> m_backEnd;
235 #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.
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.
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
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.
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const std::string unique_ptr< BackEnd > impl
shared_ptr< const Buffer > ConstBufferPtr