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, span< const uint8_t > pkcs8, 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 InputBuffers &bufs) |
Sign bufs with key using digestAlgorithm . More... | |
static ConstBufferPtr | decrypt (const KeyRefOsx &key, span< const uint8_t > cipherText) |
Decrypt cipherText with key . More... | |
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 189 of file back-end-osx.cpp.
References NDN_THROW, and ~BackEndOsx().
|
finaldefault |
Referenced by BackEndOsx().
|
static |
Definition at line 203 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 210 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 216 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 223 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 234 of file back-end-osx.cpp.
References isTpmLocked().
|
static |
Sign bufs
with key
using digestAlgorithm
.
Definition at line 253 of file back-end-osx.cpp.
References ndn::security::transform::digestFilter(), ndn::detail::CFReleaser< T >::get(), ndn::security::tpm::getDigestAlgorithm(), ndn::security::tpm::getDigestSize(), ndn::security::tpm::getFailureReason(), ndn::security::tpm::makeCFDataNoCopy(), NDN_THROW, and ndn::security::transform::streamSink().
Referenced by ndn::security::tpm::KeyHandleOsx::KeyHandleOsx().
|
static |
Decrypt cipherText
with key
.
Definition at line 312 of file back-end-osx.cpp.
References ndn::detail::CFReleaser< T >::get(), ndn::security::tpm::getFailureReason(), ndn::security::tpm::makeCFDataNoCopy(), and NDN_THROW.
Referenced by ndn::security::tpm::KeyHandleOsx::KeyHandleOsx().
|
static |
Definition at line 341 of file back-end-osx.cpp.
References ndn::OBufferStream::buf(), ndn::security::tpm::BackEnd::constructAsymmetricKeyName(), ndn::security::transform::PrivateKey::derivePublicKey(), ndn::EC, ndn::security::tpm::exportItem(), ndn::detail::cfstring::fromStdString(), ndn::detail::CFReleaser< T >::get(), ndn::security::tpm::getAsymKeyType(), ndn::security::tpm::getErrorMessage(), ndn::security::tpm::getKeyRef(), ndn::SimplePublicKeyParams< KeyParamsInfo >::getKeySize(), ndn::KeyParams::getKeyType(), ndn::security::transform::PrivateKey::loadPkcs8(), ndn::security::tpm::makeCFDataNoCopy(), ndn::security::tpm::makeCFMutableDictionary(), NDN_THROW, NDN_THROW_NESTED, ndn::detail::CFReleaser< T >::retain(), ndn::RSA, ndn::security::transform::PrivateKey::savePkcs1(), ndn::security::transform::PrivateKey::savePkcs8(), and ndn::Name::toUri().
Referenced by ndn::security::tpm::KeyHandleOsx::KeyHandleOsx().