22 #ifndef NDN_CXX_SECURITY_TPM_TPM_HPP
23 #define NDN_CXX_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;
130 decrypt(span<const uint8_t> buf,
const Name& keyName)
const;
160 unlockTpm(
const char* password,
size_t passwordLength)
const;
169 Tpm(
const std::string& locator, unique_ptr<BackEnd> impl);
182 createKey(
const Name& identityName,
const KeyParams& params);
188 deleteKey(
const Name& keyName);
203 exportPrivateKey(
const Name& keyName,
const char* pw,
size_t pwLen)
const;
218 importPrivateKey(
const Name& keyName, span<const uint8_t> pkcs8,
const char* pw,
size_t pwLen);
224 importPrivateKey(
const Name& keyName, shared_ptr<transform::PrivateKey> key);
244 findKey(
const Name& keyName)
const;
247 const std::string m_locator;
248 const unique_ptr<BackEnd> m_backEnd;
250 mutable std::unordered_map<Name, unique_ptr<KeyHandle>> m_keys;
#define NDN_CXX_NODISCARD
Base class for key parameters.
Represents an absolute name.
bool unlockTpm(const char *password, size_t passwordLength) const
Unlock the TPM.
void setTerminalMode(bool isTerminal) const
Set the terminal mode of the TPM.
ConstBufferPtr getPublicKey(const Name &keyName) const
ConstBufferPtr decrypt(span< const uint8_t > buf, const Name &keyName) const
Decrypt blob using the key with name keyName.
boost::logic::tribool verify(const InputBuffers &bufs, span< const uint8_t > sig, const Name &keyName, DigestAlgorithm digestAlgorithm) const
Verify discontiguous ranges using the key with name keyName and using the digest digestAlgorithm.
ConstBufferPtr sign(const InputBuffers &bufs, const Name &keyName, DigestAlgorithm digestAlgorithm) const
Sign discontiguous ranges using the key with name keyName and using the digest digestAlgorithm.
const std::string & getTpmLocator() const
Return the TPM Locator.
bool isTerminalMode() const
Check if the TPM is in terminal mode.
bool hasKey(const Name &keyName) const
Check if a private key exists.
The main interface for signing key management.
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
shared_ptr< const Buffer > ConstBufferPtr
span< const uint8_t > sig