8 #ifndef NDN_SECURITY_SEC_TPM_MEMORY_HPP
9 #define NDN_SECURITY_SEC_TPM_MEMORY_HPP
11 #include "../common.hpp"
56 m_inTerminal = inTerminal;
72 unlockTpm(
const char* password,
size_t passwordLength,
bool usePassword)
80 virtual shared_ptr<PublicKey>
87 signInTpm(
const uint8_t* data,
size_t dataLength,
91 decryptInTpm(
const uint8_t* data,
size_t dataLength,
const Name& keyName,
bool isSymmetric);
94 encryptInTpm(
const uint8_t* data,
size_t dataLength,
const Name& keyName,
bool isSymmetric);
124 const uint8_t* publicKeyDer,
size_t publicKeyDerLength,
125 const uint8_t* privateKeyDer,
size_t privateKeyDerLength);
144 typedef std::map<std::string, shared_ptr<PublicKey> > PublicKeyStore;
145 typedef std::map<std::string, shared_ptr<RsaPrivateKey> > PrivateKeyStore;
147 PublicKeyStore m_publicKeyStore;
148 PrivateKeyStore m_privateKeyStore;
155 #endif //NDN_SECURITY_SEC_TPM_MEMORY_HPP
virtual void generateKeyPairInTpm(const Name &keyName, KeyType keyType, int keySize)
Generate a pair of asymmetric keys.
virtual Block signInTpm(const uint8_t *data, size_t dataLength, const Name &keyName, DigestAlgorithm digestAlgorithm)
Sign data.
virtual bool importPrivateKeyPkcs1IntoTpm(const Name &keyName, const uint8_t *buf, size_t size)
virtual bool importPublicKeyPkcs1IntoTpm(const Name &keyName, const uint8_t *buf, size_t size)
Import a public key in PKCS#1 format.
virtual bool locked()
check if TPM is locked.
SecTpmMemory implements a simple in-memory TPM.
virtual bool unlockTpm(const char *password, size_t passwordLength, bool usePassword)
Unlock the TPM.
virtual ConstBufferPtr encryptInTpm(const uint8_t *data, size_t dataLength, const Name &keyName, bool isSymmetric)
Encrypt data.
Class representing wire element of the NDN packet.
virtual void addAppToACL(const Name &keyName, KeyClass keyClass, const std::string &appPath, AclType acl)
Add the application into the ACL of a particular key.
virtual shared_ptr< PublicKey > getPublicKeyFromTpm(const Name &keyName)
Get a public key.
ptr_lib::shared_ptr< const Buffer > ConstBufferPtr
SecTpm is the base class of the TPM classes.
virtual void setTpmPassword(const uint8_t *password, size_t passwordLength)
set password of TPM
virtual void resetTpmPassword()
reset password of TPM
virtual void deleteKeyPairInTpm(const Name &keyName)
Delete a key pair of asymmetric keys.
A Name holds an array of Name::Component and represents an NDN name.
virtual bool getInTerminal()
get inTerminal flag
virtual bool doesKeyExistInTpm(const Name &keyName, KeyClass keyClass)
Check if a particular key exists.
virtual ConstBufferPtr exportPrivateKeyPkcs1FromTpm(const Name &keyName)
virtual ConstBufferPtr decryptInTpm(const uint8_t *data, size_t dataLength, const Name &keyName, bool isSymmetric)
Decrypt data.
virtual void generateSymmetricKeyInTpm(const Name &keyName, KeyType keyType, int keySize)
Generate a symmetric key.
virtual bool generateRandomBlock(uint8_t *res, size_t size)
Generate a random block.
virtual void setInTerminal(bool inTerminal)
set inTerminal flag
Error(const std::string &what)
void setKeyPairForKeyName(const Name &keyName, const uint8_t *publicKeyDer, size_t publicKeyDerLength, const uint8_t *privateKeyDer, size_t privateKeyDerLength)
Set the public and private key for the keyName.