22 #ifndef NDN_SECURITY_TPM_BACK_END_HPP 23 #define NDN_SECURITY_TPM_BACK_END_HPP 25 #include "../../common.hpp" 26 #include "../../name.hpp" 27 #include "../../encoding/buffer.hpp" 28 #include "../key-params.hpp" 44 class Error :
public std::runtime_error
49 :
std::runtime_error(what)
102 exportKey(
const Name& keyName,
const char* pw,
size_t pwLen);
115 importKey(
const Name& keyName,
const uint8_t* pkcs8,
size_t pkcs8Len,
const char* pw,
size_t pwLen);
152 unlockTpm(
const char* pw,
size_t pwLen)
const;
166 doHasKey(
const Name& keyName)
const = 0;
171 virtual unique_ptr<KeyHandle>
172 doGetKeyHandle(
const Name& keyName)
const = 0;
183 virtual unique_ptr<KeyHandle>
184 doCreateKey(
const Name& identity,
const KeyParams& params) = 0;
192 doDeleteKey(
const Name& keyName) = 0;
199 doExportKey(
const Name& keyName,
const char* pw,
size_t pwLen) = 0;
212 doImportKey(
const Name& keyName,
const uint8_t* pkcs8,
size_t pkcs8Len,
const char* pw,
size_t pwLen) = 0;
219 #endif // NDN_SECURITY_TPM_BACK_END_HPP Copyright (c) 2013-2017 Regents of the University of California.
unique_ptr< KeyHandle > createKey(const Name &identity, const KeyParams ¶ms)
Create key for identity according to params.
virtual void setTerminalMode(bool isTerminal) const
Set the terminal mode of TPM.
void importKey(const Name &keyName, const uint8_t *pkcs8, size_t pkcs8Len, const char *pw, size_t pwLen)
Import a private key in encrypted PKCS #8 format.
void deleteKey(const Name &keyName)
Delete a key with name keyName.
Abstraction of TPM key handle.
virtual bool isTpmLocked() const
Abstraction of Tpm back-end.
ConstBufferPtr exportKey(const Name &keyName, const char *pw, size_t pwLen)
virtual bool isTerminalMode() const
Check if TPM is in terminal mode.
bool hasKey(const Name &keyName) const
Represents an absolute name.
static void setKeyName(KeyHandle &keyHandle, const Name &identity, const KeyParams ¶ms)
Set the key name in keyHandle according to identity and params.
virtual bool unlockTpm(const char *pw, size_t pwLen) const
Unlock TPM.
unique_ptr< KeyHandle > getKeyHandle(const Name &keyName) const
Base class of key parameters.
Error(const std::string &what)
shared_ptr< const Buffer > ConstBufferPtr