24 #ifndef NDN_SECURITY_SEC_TPM_HPP 25 #define NDN_SECURITY_SEC_TPM_HPP 27 #include "../common.hpp" 29 #include "../name.hpp" 30 #include "../data.hpp" 44 class Error :
public std::runtime_error
49 :
std::runtime_error(what)
55 SecTpm(
const std::string& location);
74 setTpmPassword(
const uint8_t* password,
size_t passwordLength) = 0;
112 unlockTpm(
const char* password,
size_t passwordLength,
bool usePassword) = 0;
139 virtual shared_ptr<PublicKey>
153 signInTpm(
const uint8_t* data,
size_t dataLength,
168 decryptInTpm(
const uint8_t* data,
size_t dataLength,
const Name& keyName,
bool isSymmetric) = 0;
181 encryptInTpm(
const uint8_t* data,
size_t dataLength,
const Name& keyName,
bool isSymmetric) = 0;
249 const uint8_t* buffer,
size_t bufferSize,
250 const std::string& password);
305 #endif // NDN_SECURITY_SEC_TPM_HPP Copyright (c) 2011-2015 Regents of the University of California.
virtual ConstBufferPtr exportPrivateKeyPkcs8FromTpm(const Name &keyName)=0
Export a private key in PKCS#8 format.
std::string getTpmLocator()
virtual void generateKeyPairInTpm(const Name &keyName, const KeyParams ¶ms)=0
Generate a pair of asymmetric keys.
Error(const std::string &what)
Class representing a wire element of NDN-TLV packet format.
virtual bool importPublicKeyPkcs1IntoTpm(const Name &keyName, const uint8_t *buffer, size_t bufferSize)=0
Import a public key in PKCS#1 formatted.
virtual void setTpmPassword(const uint8_t *password, size_t passwordLength)=0
set password of TPM
virtual bool generateRandomBlock(uint8_t *res, size_t size)=0
Generate a random block.
virtual ConstBufferPtr encryptInTpm(const uint8_t *data, size_t dataLength, const Name &keyName, bool isSymmetric)=0
Encrypt data.
virtual bool doesKeyExistInTpm(const Name &keyName, KeyClass keyClass)=0
Check if a particular key exists.
ConstBufferPtr exportPrivateKeyPkcs5FromTpm(const Name &keyName, const std::string &password)
Export a private key in PKCS#5 format.
virtual void resetTpmPassword()=0
reset password of TPM
virtual shared_ptr< PublicKey > getPublicKeyFromTpm(const Name &keyName)=0
Get a public key.
SecTpm is the base class of the TPM classes.
virtual bool isLocked()=0
Check if TPM is locked.
virtual void deleteKeyPairInTpm(const Name &keyName)=0
Delete a key pair of asymmetric keys.
Name abstraction to represent an absolute name.
virtual bool getInTerminal() const =0
Get value of inTerminal flag.
bool importPrivateKeyPkcs5IntoTpm(const Name &keyName, const uint8_t *buffer, size_t bufferSize, const std::string &password)
Import a private key in PKCS#5 formatted.
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 Block signInTpm(const uint8_t *data, size_t dataLength, const Name &keyName, DigestAlgorithm digestAlgorithm)=0
Sign data.
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.
Base class of key parameters.
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 bool importPrivateKeyPkcs8IntoTpm(const Name &keyName, const uint8_t *buffer, size_t bufferSize)=0
Import a private key from PKCS#8 formatted.
shared_ptr< const Buffer > ConstBufferPtr
virtual std::string getScheme()=0
virtual void setInTerminal(bool inTerminal)=0
Set inTerminal flag to.
SecTpm(const std::string &location)