24 #ifndef NDN_SECURITY_V1_SEC_TPM_HPP 25 #define NDN_SECURITY_V1_SEC_TPM_HPP 27 #include "../../common.hpp" 28 #include "../security-common.hpp" 29 #include "../../name.hpp" 30 #include "../../data.hpp" 31 #include "../key-params.hpp" 46 class Error :
public std::runtime_error
51 :
std::runtime_error(what)
57 SecTpm(
const std::string& location);
76 setTpmPassword(
const uint8_t* password,
size_t passwordLength) = 0;
114 unlockTpm(
const char* password,
size_t passwordLength,
bool usePassword) = 0;
141 virtual shared_ptr<v1::PublicKey>
155 signInTpm(
const uint8_t* data,
size_t dataLength,
170 decryptInTpm(
const uint8_t* data,
size_t dataLength,
const Name& keyName,
bool isSymmetric) = 0;
183 encryptInTpm(
const uint8_t* data,
size_t dataLength,
const Name& keyName,
bool isSymmetric) = 0;
251 const uint8_t* buffer,
size_t bufferSize,
252 const std::string& password);
307 #ifdef NDN_CXX_KEEP_SECURITY_V1_ALIASES 309 #endif // NDN_CXX_KEEP_SECURITY_V1_ALIASES 313 #ifdef NDN_CXX_KEEP_SECURITY_V1_ALIASES 315 #endif // NDN_CXX_KEEP_SECURITY_V1_ALIASES 319 #endif // NDN_SECURITY_V1_SEC_TPM_HPP virtual bool getInTerminal() const =0
Get value of inTerminal flag.
Copyright (c) 2013-2017 Regents of the University of California.
Error(const std::string &what)
virtual shared_ptr< v1::PublicKey > getPublicKeyFromTpm(const Name &keyName)=0
Get a public key.
virtual ConstBufferPtr exportPrivateKeyPkcs8FromTpm(const Name &keyName)=0
Export a private key in PKCS#8 format.
virtual std::string getScheme()=0
virtual void resetTpmPassword()=0
reset password of TPM
std::string getTpmLocator()
virtual Block signInTpm(const uint8_t *data, size_t dataLength, const Name &keyName, DigestAlgorithm digestAlgorithm)=0
Sign data.
Represents a TLV element of NDN packet format.
virtual bool isLocked()=0
Check if TPM is locked.
virtual bool generateRandomBlock(uint8_t *res, size_t size)=0
Generate a random block.
virtual bool unlockTpm(const char *password, size_t passwordLength, bool usePassword)=0
Unlock the TPM.
virtual void generateSymmetricKeyInTpm(const Name &keyName, const KeyParams ¶ms)=0
Generate a symmetric key.
bool importPrivateKeyPkcs5IntoTpm(const Name &keyName, const uint8_t *buffer, size_t bufferSize, const std::string &password)
Import a private key in PKCS#5 formatted buffer of size bufferSize.
virtual bool doesKeyExistInTpm(const Name &keyName, KeyClass keyClass)=0
Check if a particular key exists.
Represents an absolute name.
virtual void addAppToAcl(const Name &keyName, KeyClass keyClass, const std::string &appPath, AclType acl)=0
Add the application into the ACL of a particular key.
virtual ConstBufferPtr encryptInTpm(const uint8_t *data, size_t dataLength, const Name &keyName, bool isSymmetric)=0
Encrypt data.
virtual bool importPublicKeyPkcs1IntoTpm(const Name &keyName, const uint8_t *buffer, size_t bufferSize)=0
Import a public key in PKCS#1 formatted buffer of size bufferSize.
SecTpm is the base class of the TPM classes.
virtual void deleteKeyPairInTpm(const Name &keyName)=0
Delete a key pair of asymmetric keys.
Base class of key parameters.
SecTpm(const std::string &location)
virtual void setInTerminal(bool inTerminal)=0
Set inTerminal flag to inTerminal.
virtual void setTpmPassword(const uint8_t *password, size_t passwordLength)=0
set password of TPM
ConstBufferPtr exportPrivateKeyPkcs5FromTpm(const Name &keyName, const std::string &password)
Export a private key in PKCS#5 format.
shared_ptr< const Buffer > ConstBufferPtr
virtual bool getImpExpPassWord(std::string &password, const std::string &prompt)
Get import/export password.
virtual ConstBufferPtr decryptInTpm(const uint8_t *data, size_t dataLength, const Name &keyName, bool isSymmetric)=0
Decrypt data.
virtual bool importPrivateKeyPkcs8IntoTpm(const Name &keyName, const uint8_t *buffer, size_t bufferSize)=0
Import a private key from PKCS#8 formatted buffer of size bufferSize.
virtual void generateKeyPairInTpm(const Name &keyName, const KeyParams ¶ms)=0
Generate a pair of asymmetric keys.