The back-end implementation of TPM based on macOS Keychain Services. More...
#include <back-end-osx.hpp>
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< KeyHandle > | getKeyHandle (const Name &keyName) const |
Get the handle of the key with name keyName . More... | |
unique_ptr< KeyHandle > | createKey (const Name &identityName, const KeyParams ¶ms) |
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 ¶ms) 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 ¶ms) const |
Construct and return the name of a HMAC key, based on identity and params . More... | |
The back-end implementation of TPM based on macOS Keychain Services.
Definition at line 40 of file back-end-osx.hpp.
|
explicit |
Create TPM backed based on macOS Keychain Services.
location | Not used (required by the TPM registration interface). |
Definition at line 185 of file back-end-osx.cpp.
References NDN_THROW.
|
finaldefault |
|
static |
Definition at line 199 of file back-end-osx.cpp.
|
finalvirtual |
Check if the TPM is in terminal mode.
The default implementation always returns true.
Reimplemented from ndn::security::tpm::BackEnd.
Definition at line 206 of file back-end-osx.cpp.
|
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.
|
finalvirtual |
Check if the TPM is locked.
The default implementation always returns false.
Reimplemented from ndn::security::tpm::BackEnd.
Definition at line 219 of file back-end-osx.cpp.
Referenced by unlockTpm().
|
finalvirtual |
Unlock the TPM.
The default implementation does nothing and returns !isTpmLocked()
.
pw | The password to unlock the TPM. |
pwLen | The length of the password. |
Reimplemented from ndn::security::tpm::BackEnd.
Definition at line 230 of file back-end-osx.cpp.
References isTpmLocked().
|
static |
Sign buf
with key
using digestAlgorithm
.
Definition at line 249 of file back-end-osx.cpp.
References buf, ndn::detail::CFReleaser< T >::get(), ndn::security::tpm::getDigestAlgorithm(), ndn::security::tpm::getDigestSize(), ndn::security::tpm::getFailureReason(), ndn::security::tpm::makeCFDataNoCopy(), and NDN_THROW.
|
static |
Definition at line 295 of file back-end-osx.cpp.
References ndn::detail::CFReleaser< T >::get(), ndn::security::tpm::getFailureReason(), ndn::security::tpm::makeCFDataNoCopy(), and NDN_THROW.
|
static |
Definition at line 324 of file back-end-osx.cpp.
References ndn::security::transform::PrivateKey::derivePublicKey(), and ndn::security::tpm::exportItem().