All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Classes | Public Member Functions | Friends | List of all members
ndn::Tpm Class Reference

The TPM (Trusted Platform Module) stores the private portion of a user's cryptography keys. More...

#include <tpm.hpp>

Classes

class  Error
 A Tpm::Error extends runtime_error and represents a semantic error in TPM processing. More...
 

Public Member Functions

std::string getTpmLocator () const
 
bool hasKey (const Name &keyName) const
 Check if the key with name keyName exists in the TPM. More...
 
Blob getPublicKey (const Name &keyName) const
 Get the public portion of an asymmetric key pair with name keyName. More...
 
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. More...
 
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. More...
 
bool isTerminalMode () const
 Check if the TPM is in terminal mode. More...
 
void setTerminalMode (bool isTerminal) const
 Set the terminal mode of the TPM. More...
 
bool isTpmLocked () const
 Check if the TPM is locked. More...
 
bool unlockTpm (const uint8_t *password, size_t passwordLength) const
 Unlock the TPM. More...
 

Friends

class KeyChain
 
class SafeBag
 

Detailed Description

The TPM (Trusted Platform Module) stores the private portion of a user's cryptography keys.

The format and location of stored information is indicated by the TPM locator. The TPM is designed to work with a PIB (Public Information Base) which stores public keys and related information such as certificates.

The TPM also provides functionalities of cryptographic transformation, such as signing and decryption.

A TPM consists of a unified front-end interface and a backend implementation. The front-end caches the handles of private keys which are provided by the backend implementation.

Note: A Tpm instance is created and managed only by the KeyChain. It is returned by the KeyChain getTpm() method, through which it is possible to check for the existence of private keys, get public keys for the private keys, sign, and decrypt the supplied buffers using managed private keys.

Member Function Documentation

Blob ndn::Tpm::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.

Parameters
cipherTextThe cipher text byte array.
cipherTextLengthThe length of the cipher text byte array.
keyNameThe name of the key.
Returns
The decrypted data, or an isNull Blob if the key does not exist.
Blob ndn::Tpm::getPublicKey ( const Name keyName) const

Get the public portion of an asymmetric key pair with name keyName.

Parameters
keyNameThe name of the key.
Returns
The encoded public key, or an isNull Blob if the key does not exist.
bool ndn::Tpm::hasKey ( const Name keyName) const

Check if the key with name keyName exists in the TPM.

Parameters
keyNameThe name of the key.
Returns
True if the key exists.
bool ndn::Tpm::isTerminalMode ( ) const

Check if the TPM is in terminal mode.

Returns
True if in terminal mode.
bool ndn::Tpm::isTpmLocked ( ) const

Check if the TPM is locked.

Returns
True if the TPM is locked, otherwise false.
void ndn::Tpm::setTerminalMode ( bool  isTerminal) const

Set the terminal mode of the TPM.

In terminal mode, the TPM will not ask for a password from the GUI.

Parameters
isTerminalTrue to enable terminal mode.
Blob ndn::Tpm::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.

Parameters
dataThe input byte array.
dataLengthThe length of the byte array.
keyNameThe name of the key.
digestAlgorithmThe digest algorithm for the signature.
Returns
The signature Blob, or an isNull Blob if the key does not exist, or for an unrecognized digestAlgorithm.
bool ndn::Tpm::unlockTpm ( const uint8_t *  password,
size_t  passwordLength 
) const

Unlock the TPM.

If !isTerminalMode(), prompt for a password from the GUI.

Parameters
passwordThe password to unlock TPM.
passwordLengthThe length of the password.
Returns
True if the TPM was unlocked.

The documentation for this class was generated from the following files: