The back-end implementation of TPM based on macOS Keychain Services.
More...
#include <back-end-osx.hpp>
|
| BackEndOsx (const std::string &location="") |
| Create TPM backed based on macOS KeyChain service. More...
|
|
| ~BackEndOsx () override |
|
bool | isTerminalMode () const final |
| Check if TPM is in terminal mode. More...
|
|
void | setTerminalMode (bool isTerminal) const final |
| Set the terminal mode of TPM. More...
|
|
bool | isTpmLocked () const final |
|
bool | unlockTpm (const char *pw, size_t pwLen) const final |
| Unlock TPM. More...
|
|
ConstBufferPtr | sign (const KeyRefOsx &key, DigestAlgorithm digestAlgorithm, const uint8_t *buf, size_t size) const |
| Sign buf with key using digestAlgorithm . More...
|
|
ConstBufferPtr | decrypt (const KeyRefOsx &key, const uint8_t *cipherText, size_t cipherSize) const |
|
ConstBufferPtr | derivePublicKey (const KeyRefOsx &key) const |
|
bool | hasKey (const Name &keyName) const |
|
unique_ptr< KeyHandle > | getKeyHandle (const Name &keyName) const |
|
unique_ptr< KeyHandle > | createKey (const Name &identity, const KeyParams ¶ms) |
| Create key for identity according to params . More...
|
|
void | deleteKey (const Name &keyName) |
| Delete a key with name keyName . More...
|
|
ConstBufferPtr | exportKey (const Name &keyName, const char *pw, size_t pwLen) |
|
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...
|
|
The back-end implementation of TPM based on macOS Keychain Services.
Definition at line 39 of file back-end-osx.hpp.
ndn::security::tpm::BackEndOsx::BackEndOsx |
( |
const std::string & |
location = "" | ) |
|
|
explicit |
Create TPM backed based on macOS KeyChain service.
- Parameters
-
location | Not used (required by the TPM-registration interface) |
Definition at line 120 of file back-end-osx.cpp.
ndn::security::tpm::BackEndOsx::~BackEndOsx |
( |
| ) |
|
|
overridedefault |
unique_ptr< KeyHandle > ndn::security::tpm::BackEnd::createKey |
( |
const Name & |
identity, |
|
|
const KeyParams & |
params |
|
) |
| |
|
inherited |
Create key for identity
according to params
.
The key name is set in the returned KeyHandle.
- Returns
- The handle of the created key.
- Exceptions
-
Definition at line 49 of file back-end.cpp.
ConstBufferPtr ndn::security::tpm::BackEndOsx::decrypt |
( |
const KeyRefOsx & |
key, |
|
|
const uint8_t * |
cipherText, |
|
|
size_t |
cipherSize |
|
) |
| const |
void ndn::security::tpm::BackEnd::deleteKey |
( |
const Name & |
keyName | ) |
|
|
inherited |
Delete a key with name keyName
.
Continuing to use existing KeyHandles on a deleted key results in undefined behavior.
- Exceptions
-
Error | if the deletion fails. |
Definition at line 84 of file back-end.cpp.
ConstBufferPtr ndn::security::tpm::BackEnd::exportKey |
( |
const Name & |
keyName, |
|
|
const char * |
pw, |
|
|
size_t |
pwLen |
|
) |
| |
|
inherited |
- Returns
- A private key with name
keyName
in encrypted PKCS #8 format using password pw
- Exceptions
-
Error | the key does not exist |
Error | the key cannot be exported, e.g., insufficient privilege |
Definition at line 90 of file back-end.cpp.
unique_ptr< KeyHandle > ndn::security::tpm::BackEnd::getKeyHandle |
( |
const Name & |
keyName | ) |
const |
|
inherited |
- Returns
- The handle of a key with name
keyName
, or nullptr if the key does not exist.
Calling getKeyHandle multiple times with the same keyName will return different KeyHandle objects that all refer to the same key.
Definition at line 43 of file back-end.cpp.
const std::string & ndn::security::tpm::BackEndOsx::getScheme |
( |
| ) |
|
|
static |
bool ndn::security::tpm::BackEnd::hasKey |
( |
const Name & |
keyName | ) |
const |
|
inherited |
- Returns
- True if a key with name
keyName
exists in TPM.
Definition at line 37 of file back-end.cpp.
void ndn::security::tpm::BackEnd::importKey |
( |
const Name & |
keyName, |
|
|
const uint8_t * |
pkcs8, |
|
|
size_t |
pkcs8Len, |
|
|
const char * |
pw, |
|
|
size_t |
pwLen |
|
) |
| |
|
inherited |
Import a private key in encrypted PKCS #8 format.
- Parameters
-
keyName | The name of imported private key |
pkcs8 | Pointer to the key in encrypted PKCS #8 format |
pkcs8Len | The size of the key in encrypted PKCS #8 format |
pw | The password to decrypt the private key |
pwLen | The length of the password |
- Exceptions
-
Definition at line 99 of file back-end.cpp.
bool ndn::security::tpm::BackEndOsx::isTerminalMode |
( |
| ) |
const |
|
finalvirtual |
bool ndn::security::tpm::BackEndOsx::isTpmLocked |
( |
| ) |
const |
|
finalvirtual |
void ndn::security::tpm::BackEnd::setKeyName |
( |
KeyHandle & |
keyHandle, |
|
|
const Name & |
identity, |
|
|
const KeyParams & |
params |
|
) |
| |
|
staticprotectedinherited |
Set the key name in keyHandle
according to identity
and params
.
Definition at line 108 of file back-end.cpp.
void ndn::security::tpm::BackEndOsx::setTerminalMode |
( |
bool |
isTerminal | ) |
const |
|
finalvirtual |
bool ndn::security::tpm::BackEndOsx::unlockTpm |
( |
const char * |
pw, |
|
|
size_t |
pwLen |
|
) |
| const |
|
finalvirtual |