22 #ifndef NDN_SECURITY_TPM_TPM_HPP 23 #define NDN_SECURITY_TPM_TPM_HPP 29 #include <unordered_map> 30 #include <boost/logic/tribool.hpp> 65 class Tpm : noncopyable
68 class Error :
public std::runtime_error
71 using std::runtime_error::runtime_error;
77 getTpmLocator()
const;
86 hasKey(
const Name& keyName)
const;
95 getPublicKey(
const Name& keyName)
const;
114 return sign({{buf, size}}, keyName, digestAlgorithm);
125 boost::logic::tribool
126 verify(
const InputBuffers& bufs,
const uint8_t*
sig,
size_t sigLen,
const Name& keyName,
136 boost::logic::tribool
137 verify(
const uint8_t* buf,
size_t bufLen,
const uint8_t* sig,
size_t sigLen,
140 return verify({{buf, bufLen}},
sig,
sigLen, keyName, digestAlgorithm);
149 decrypt(
const uint8_t* buf,
size_t size,
const Name& keyName)
const;
156 isTerminalMode()
const;
164 setTerminalMode(
bool isTerminal)
const;
179 unlockTpm(
const char* password,
size_t passwordLength)
const;
189 Tpm(
const std::string& scheme,
const std::string& location, unique_ptr<BackEnd> impl);
202 createKey(
const Name& identityName,
const KeyParams& params);
208 deleteKey(
const Name& keyName);
222 exportPrivateKey(
const Name& keyName,
const char* pw,
size_t pwLen)
const;
235 importPrivateKey(
const Name& keyName,
const uint8_t* pkcs8,
size_t pkcs8Len,
236 const char* pw,
size_t pwLen);
242 importPrivateKey(
const Name& keyName, shared_ptr<transform::PrivateKey> key);
262 findKey(
const Name& keyName)
const;
265 std::string m_scheme;
266 std::string m_location;
268 mutable std::unordered_map<Name, unique_ptr<KeyHandle>> m_keys;
270 const unique_ptr<BackEnd> m_backEnd;
282 #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.
The interface of signing key management.
Abstraction of TPM key handle.
boost::logic::tribool verify(const uint8_t *buf, size_t bufLen, const uint8_t *sig, size_t sigLen, const Name &keyName, DigestAlgorithm digestAlgorithm) const
Verify blob using the key with name keyName and using the digest digestAlgorithm. ...
#define NDN_CXX_NODISCARD
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
Represents an absolute name.
Base class for key parameters.
shared_ptr< const Buffer > ConstBufferPtr