22 #ifndef NDN_CXX_SECURITY_TPM_BACK_END_HPP
23 #define NDN_CXX_SECURITY_TPM_BACK_END_HPP
107 importKey(
const Name& keyName, span<const uint8_t> pkcs8,
const char* pw,
size_t pwLen);
115 importKey(
const Name& keyName, shared_ptr<transform::PrivateKey> key);
167 [[nodiscard]]
virtual bool
190 doHasKey(
const Name& keyName)
const = 0;
192 virtual unique_ptr<KeyHandle>
193 doGetKeyHandle(
const Name& keyName)
const = 0;
195 virtual unique_ptr<KeyHandle>
196 doCreateKey(
const Name& identity,
const KeyParams& params) = 0;
199 doDeleteKey(
const Name& keyName) = 0;
202 doExportKey(
const Name& keyName,
const char* pw,
size_t pwLen) = 0;
205 doImportKey(
const Name& keyName, span<const uint8_t> pkcs8,
const char* pw,
size_t pwLen) = 0;
208 doImportKey(
const Name& keyName, shared_ptr<transform::PrivateKey> key) = 0;
Base class for key parameters.
Represents an absolute name.
Abstract interface for a TPM backend implementation.
unique_ptr< KeyHandle > createKey(const Name &identityName, const KeyParams ¶ms)
Create a key for identityName according to params.
void importKey(const Name &keyName, span< const uint8_t > pkcs8, const char *pw, size_t pwLen)
Import a private key in encrypted PKCS #8 format.
virtual bool isTpmLocked() const
Check if the TPM is locked.
bool hasKey(const Name &keyName) const
Check if the key with name keyName exists in the TPM.
Name constructAsymmetricKeyName(const KeyHandle &key, const Name &identity, const KeyParams ¶ms) const
Construct and return the name of a RSA or EC key, based on identity and params.
void deleteKey(const Name &keyName)
Delete the key with name keyName.
virtual bool unlockTpm(const char *pw, size_t pwLen) const
Unlock the TPM.
virtual bool isTerminalMode() const
Check if the TPM is in terminal mode.
ConstBufferPtr exportKey(const Name &keyName, const char *pw, size_t pwLen)
Get the private key with name keyName in encrypted PKCS #8 format.
unique_ptr< KeyHandle > getKeyHandle(const Name &keyName) const
Get the handle of the key with name keyName.
virtual void setTerminalMode(bool isTerminal) const
Set the terminal mode of the TPM.
Name constructHmacKeyName(const transform::PrivateKey &key, const Name &identity, const KeyParams ¶ms) const
Construct and return the name of a HMAC key, based on identity and params.
Abstraction of TPM key handle.
std::shared_ptr< const Buffer > ConstBufferPtr