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" 45 class Error :
public std::runtime_error
50 :
std::runtime_error(what)
56 SecTpm(
const std::string& location);
75 setTpmPassword(
const uint8_t* password,
size_t passwordLength) = 0;
113 unlockTpm(
const char* password,
size_t passwordLength,
bool usePassword) = 0;
140 virtual shared_ptr<v1::PublicKey>
154 signInTpm(
const uint8_t* data,
size_t dataLength,
169 decryptInTpm(
const uint8_t* data,
size_t dataLength,
const Name& keyName,
bool isSymmetric) = 0;
182 encryptInTpm(
const uint8_t* data,
size_t dataLength,
const Name& keyName,
bool isSymmetric) = 0;
250 const uint8_t* buffer,
size_t bufferSize,
251 const std::string& password);
310 #endif // NDN_SECURITY_SEC_TPM_HPP Copyright (c) 2011-2015 Regents of the University of California.
virtual void deleteKeyPairInTpm(const Name &keyName)=0
Delete a key pair of asymmetric keys.
virtual void generateKeyPairInTpm(const Name &keyName, const KeyParams ¶ms)=0
Generate a pair of asymmetric keys.
virtual void setTpmPassword(const uint8_t *password, size_t passwordLength)=0
set password of TPM
virtual void setInTerminal(bool inTerminal)=0
Set inTerminal flag to inTerminal.
SecTpm is the base class of the TPM classes.
Class representing a wire element of NDN-TLV packet format.
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 addAppToAcl(const Name &keyName, KeyClass keyClass, const std::string &appPath, AclType acl)=0
Add the application into the ACL of a particular key.
ConstBufferPtr exportPrivateKeyPkcs5FromTpm(const Name &keyName, const std::string &password)
Export a private key in PKCS#5 format.
SecTpm(const std::string &location)
std::string getTpmLocator()
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.
virtual bool generateRandomBlock(uint8_t *res, size_t size)=0
Generate a random block.
virtual shared_ptr< v1::PublicKey > getPublicKeyFromTpm(const Name &keyName)=0
Get a public key.
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.
Name abstraction to represent an absolute name.
virtual bool getInTerminal() const =0
Get value of inTerminal flag.
virtual bool isLocked()=0
Check if TPM is locked.
virtual ConstBufferPtr decryptInTpm(const uint8_t *data, size_t dataLength, const Name &keyName, bool isSymmetric)=0
Decrypt data.
virtual ConstBufferPtr exportPrivateKeyPkcs8FromTpm(const Name &keyName)=0
Export a private key in PKCS#8 format.
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.
Base class of key parameters.
virtual void generateSymmetricKeyInTpm(const Name &keyName, const KeyParams ¶ms)=0
Generate a symmetric key.
virtual std::string getScheme()=0
virtual bool getImpExpPassWord(std::string &password, const std::string &prompt)
Get import/export password.
shared_ptr< const Buffer > ConstBufferPtr
virtual ConstBufferPtr encryptInTpm(const uint8_t *data, size_t dataLength, const Name &keyName, bool isSymmetric)=0
Encrypt data.
Error(const std::string &what)
virtual bool doesKeyExistInTpm(const Name &keyName, KeyClass keyClass)=0
Check if a particular key exists.
virtual void resetTpmPassword()=0
reset password of TPM