27 #include "../../name.hpp"
28 #include "../key-params.hpp"
60 class Error :
public std::runtime_error
63 Error(
const std::string& what)
64 : std::runtime_error(what)
70 getTpmLocator()
const;
100 (
const uint8_t* data,
size_t dataLength,
const Name& keyName,
101 DigestAlgorithm digestAlgorithm)
const;
113 (
const uint8_t* cipherText,
size_t cipherTextLength,
114 const Name& keyName)
const;
147 unlockTpm(
const uint8_t* password,
size_t passwordLength)
const;
160 Tpm(
const std::string& scheme,
const std::string& location,
161 const ptr_lib::shared_ptr<TpmBackEnd>& backEnd);
164 getBackEnd() {
return backEnd_.get(); }
176 createKey(
const Name& identityName,
const KeyParams& params);
185 deleteKey(
const Name& keyName);
203 (
const Name& keyName,
const uint8_t* password,
size_t passwordLength);
222 (
const Name& keyName,
const uint8_t* pkcs8,
size_t pkcs8Length,
223 const uint8_t* password,
size_t passwordLength);
233 findKey(
const Name& keyName)
const;
237 Tpm& operator=(
const Tpm& other);
240 std::string location_;
242 std::map<Name, ptr_lib::shared_ptr<TpmKeyHandle>> keys_;
244 ptr_lib::shared_ptr<TpmBackEnd> backEnd_;
bool isTpmLocked() const
Check if the TPM is locked.
Definition: tpm.cpp:92
void setTerminalMode(bool isTerminal) const
Set the terminal mode of the TPM.
Definition: tpm.cpp:86
bool isTerminalMode() const
Check if the TPM is in terminal mode.
Definition: tpm.cpp:83
Blob getPublicKey(const Name &keyName) const
Get the public portion of an asymmetric key pair with name keyName.
Definition: tpm.cpp:47
bool unlockTpm(const uint8_t *password, size_t passwordLength) const
Unlock the TPM.
Definition: tpm.cpp:95
The TPM (Trusted Platform Module) stores the private portion of a user's cryptography keys...
Definition: tpm.hpp:54
TpmBackEnd is an abstract base class for a TPM backend implementation which provides a TpmKeyHandle t...
Definition: tpm-back-end.hpp:39
TpmKeyHandle is an abstract base class for a TPM key handle, which provides an interface to perform c...
Definition: tpm-key-handle.hpp:35
KeyChain is the main class of the security library.
Definition: key-chain.hpp:53
bool hasKey(const Name &keyName) const
Check if the key with name keyName exists in the TPM.
Definition: tpm.cpp:44
A Tpm::Error extends runtime_error and represents a semantic error in TPM processing.
Definition: tpm.hpp:60
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:40
A Blob holds a pointer to an immutable byte array implemented as const std::vector<uint8_t>.
Definition: blob.hpp:42
A SafeBag represents a container for sensitive related information such as a certificate and private ...
Definition: safe-bag.hpp:35
KeyParams is a base class for key parameters.
Definition: key-params.hpp:36
Blob decrypt(const uint8_t *cipherText, size_t cipherTextLength, const Name &keyName) const
Return the plain text which is decrypted from cipherText using the key with name keyName.
Definition: tpm.cpp:72
Blob sign(const uint8_t *data, size_t dataLength, const Name &keyName, DigestAlgorithm digestAlgorithm) const
Compute a digital signature from the byte array using the key with name keyName.
Definition: tpm.cpp:59