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>
62class 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;
136 Tpm(
const std::string& locator, unique_ptr<BackEnd> impl);
149 createKey(
const Name& identityName,
const KeyParams& params);
155 deleteKey(
const Name& keyName);
170 exportPrivateKey(
const Name& keyName,
const char* pw,
size_t pwLen)
const;
185 importPrivateKey(
const Name& keyName, span<const uint8_t> pkcs8,
const char* pw,
size_t pwLen);
191 importPrivateKey(
const Name& keyName, shared_ptr<transform::PrivateKey> key);
211 findKey(
const Name& keyName)
const;
214 const std::string m_locator;
215 const unique_ptr<BackEnd> m_backEnd;
217 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.
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.
const std::string & getTpmLocator() const
Return the TPM Locator.
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.
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