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>
62 class Tpm : noncopyable
65 class Error :
public std::runtime_error
68 using std::runtime_error::runtime_error;
117 [[nodiscard]] boost::logic::tribool
127 decrypt(span<const uint8_t> buf,
const Name& keyName)
const;
165 unlockTpm(
const char* password,
size_t passwordLength)
const;
174 Tpm(
const std::string& locator, unique_ptr<BackEnd> impl);
187 createKey(
const Name& identityName,
const KeyParams& params);
193 deleteKey(
const Name& keyName);
208 exportPrivateKey(
const Name& keyName,
const char* pw,
size_t pwLen)
const;
223 importPrivateKey(
const Name& keyName, span<const uint8_t> pkcs8,
const char* pw,
size_t pwLen);
229 importPrivateKey(
const Name& keyName, shared_ptr<transform::PrivateKey> key);
249 findKey(
const Name& keyName)
const;
252 const std::string m_locator;
253 const unique_ptr<BackEnd> m_backEnd;
255 mutable std::unordered_map<Name, unique_ptr<KeyHandle>> m_keys;
Base class for key parameters.
Represents an absolute name.
The main interface for signing key management.
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.
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
Contains the ndn-cxx security framework.
std::shared_ptr< const Buffer > ConstBufferPtr
span< const uint8_t > sig