NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::security::tpm::BackEndOsx Class Referencefinal

The back-end implementation of TPM based on macOS Keychain Services. More...

#include <back-end-osx.hpp>

Inheritance diagram for ndn::security::tpm::BackEndOsx:
Collaboration diagram for ndn::security::tpm::BackEndOsx:

Classes

class  Impl
 

Public Member Functions

 BackEndOsx (const std::string &location="")
 Create TPM backed based on macOS Keychain Services. More...
 
 ~BackEndOsx () final
 
bool isTerminalMode () const final
 Check if the TPM is in terminal mode. More...
 
void setTerminalMode (bool isTerminal) const final
 Set the terminal mode of the TPM. More...
 
bool isTpmLocked () const final
 Check if the TPM is locked. More...
 
bool unlockTpm (const char *pw, size_t pwLen) const final
 Unlock the TPM. More...
 
- Public Member Functions inherited from ndn::security::tpm::BackEnd
virtual ~BackEnd ()
 
bool hasKey (const Name &keyName) const
 Check if the key with name keyName exists in the TPM. More...
 
unique_ptr< KeyHandlegetKeyHandle (const Name &keyName) const
 Get the handle of the key with name keyName. More...
 
unique_ptr< KeyHandlecreateKey (const Name &identityName, const KeyParams &params)
 Create a key for identityName according to params. More...
 
void deleteKey (const Name &keyName)
 Delete the key with name keyName. More...
 
ConstBufferPtr exportKey (const Name &keyName, const char *pw, size_t pwLen)
 Get the private key with name keyName in encrypted PKCS #8 format. More...
 
void importKey (const Name &keyName, const uint8_t *pkcs8, size_t pkcs8Len, const char *pw, size_t pwLen)
 Import a private key in encrypted PKCS #8 format. More...
 
void importKey (const Name &keyName, shared_ptr< transform::PrivateKey > key)
 Import a private key. More...
 

Static Public Member Functions

static const std::string & getScheme ()
 
static ConstBufferPtr sign (const KeyRefOsx &key, DigestAlgorithm digestAlgorithm, const uint8_t *buf, size_t size)
 Sign buf with key using digestAlgorithm. More...
 
static ConstBufferPtr decrypt (const KeyRefOsx &key, const uint8_t *cipherText, size_t cipherSize)
 
static ConstBufferPtr derivePublicKey (const KeyRefOsx &key)
 

Additional Inherited Members

- Public Types inherited from ndn::security::tpm::BackEnd
using Error = Tpm::Error
 
- Protected Member Functions inherited from ndn::security::tpm::BackEnd
Name constructAsymmetricKeyName (const KeyHandle &key, const Name &identity, const KeyParams &params) const
 Construct and return the name of a RSA or EC key, based on identity and params. More...
 
Name constructHmacKeyName (const transform::PrivateKey &key, const Name &identity, const KeyParams &params) const
 Construct and return the name of a HMAC key, based on identity and params. More...
 

Detailed Description

The back-end implementation of TPM based on macOS Keychain Services.

Definition at line 40 of file back-end-osx.hpp.

Constructor & Destructor Documentation

◆ BackEndOsx()

ndn::security::tpm::BackEndOsx::BackEndOsx ( const std::string &  location = "")
explicit

Create TPM backed based on macOS Keychain Services.

Parameters
locationNot used (required by the TPM registration interface).

Definition at line 185 of file back-end-osx.cpp.

References NDN_THROW.

◆ ~BackEndOsx()

ndn::security::tpm::BackEndOsx::~BackEndOsx ( )
finaldefault

Member Function Documentation

◆ getScheme()

const std::string & ndn::security::tpm::BackEndOsx::getScheme ( )
static

Definition at line 199 of file back-end-osx.cpp.

◆ isTerminalMode()

bool ndn::security::tpm::BackEndOsx::isTerminalMode ( ) const
finalvirtual

Check if the TPM is in terminal mode.

The default implementation always returns true.

Returns
True if in terminal mode, false otherwise.

Reimplemented from ndn::security::tpm::BackEnd.

Definition at line 206 of file back-end-osx.cpp.

◆ setTerminalMode()

void ndn::security::tpm::BackEndOsx::setTerminalMode ( bool  isTerminal) const
finalvirtual

Set the terminal mode of the TPM.

In terminal mode, the TPM will not ask for a password from the GUI. The default implementation does nothing.

Reimplemented from ndn::security::tpm::BackEnd.

Definition at line 212 of file back-end-osx.cpp.

◆ isTpmLocked()

bool ndn::security::tpm::BackEndOsx::isTpmLocked ( ) const
finalvirtual

Check if the TPM is locked.

The default implementation always returns false.

Returns
True if locked, false otherwise.

Reimplemented from ndn::security::tpm::BackEnd.

Definition at line 219 of file back-end-osx.cpp.

Referenced by unlockTpm().

◆ unlockTpm()

bool ndn::security::tpm::BackEndOsx::unlockTpm ( const char *  pw,
size_t  pwLen 
) const
finalvirtual

Unlock the TPM.

The default implementation does nothing and returns !isTpmLocked().

Parameters
pwThe password to unlock the TPM.
pwLenThe length of the password.
Returns
True if the TPM was unlocked.

Reimplemented from ndn::security::tpm::BackEnd.

Definition at line 230 of file back-end-osx.cpp.

References isTpmLocked().

◆ sign()

ConstBufferPtr ndn::security::tpm::BackEndOsx::sign ( const KeyRefOsx key,
DigestAlgorithm  digestAlgorithm,
const uint8_t *  buf,
size_t  size 
)
static

◆ decrypt()

ConstBufferPtr ndn::security::tpm::BackEndOsx::decrypt ( const KeyRefOsx key,
const uint8_t *  cipherText,
size_t  cipherSize 
)
static

◆ derivePublicKey()

ConstBufferPtr ndn::security::tpm::BackEndOsx::derivePublicKey ( const KeyRefOsx key)
static

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