#include <sec-tpm-osx.hpp>
Data Structures | |
| class | Error |
| class | Impl |
Public Member Functions | |
| SecTpmOsx () | |
| virtual | ~SecTpmOsx () |
| virtual void | setTpmPassword (const uint8_t *password, size_t passwordLength) |
| set password of TPM More... | |
| virtual void | resetTpmPassword () |
| reset password of TPM More... | |
| virtual void | setInTerminal (bool inTerminal) |
| set inTerminal flag More... | |
| virtual bool | getInTerminal () |
| get inTerminal flag More... | |
| virtual bool | locked () |
| check if TPM is locked. More... | |
| virtual bool | unlockTpm (const char *password, size_t passwordLength, bool usePassword) |
| Unlock the TPM. More... | |
| virtual void | generateKeyPairInTpm (const Name &keyName, KeyType keyType, int keySize) |
| Generate a pair of asymmetric keys. More... | |
| virtual void | deleteKeyPairInTpm (const Name &keyName) |
| Delete a key pair of asymmetric keys. More... | |
| virtual shared_ptr< PublicKey > | getPublicKeyFromTpm (const Name &keyName) |
| Get a public key. More... | |
| virtual Block | signInTpm (const uint8_t *data, size_t dataLength, const Name &keyName, DigestAlgorithm digestAlgorithm) |
| Sign data. More... | |
| virtual ConstBufferPtr | decryptInTpm (const uint8_t *data, size_t dataLength, const Name &keyName, bool isSymmetric) |
| Decrypt data. More... | |
| virtual ConstBufferPtr | encryptInTpm (const uint8_t *data, size_t dataLength, const Name &keyName, bool isSymmetric) |
| Encrypt data. More... | |
| virtual void | generateSymmetricKeyInTpm (const Name &keyName, KeyType keyType, int keySize) |
| Generate a symmetric key. More... | |
| virtual bool | doesKeyExistInTpm (const Name &keyName, KeyClass keyClass) |
| Check if a particular key exists. More... | |
| virtual bool | generateRandomBlock (uint8_t *res, size_t size) |
| Generate a random block. More... | |
| virtual void | addAppToACL (const Name &keyName, KeyClass keyClass, const std::string &appPath, AclType acl) |
| Add the application into the ACL of a particular key. More... | |
| ConstBufferPtr | exportPrivateKeyPkcs5FromTpm (const Name &keyName, const std::string &password) |
| Export a private key in PKCS#5 format. More... | |
| bool | importPrivateKeyPkcs5IntoTpm (const Name &keyName, const uint8_t *buf, size_t size, const std::string &password) |
| Import a private key in PKCS#5 format. More... | |
Protected Member Functions | |
| virtual ConstBufferPtr | exportPrivateKeyPkcs8FromTpm (const Name &keyName) |
| Export a private key in PKCS#8 format. More... | |
| virtual bool | importPrivateKeyPkcs8IntoTpm (const Name &keyName, const uint8_t *buf, size_t size) |
| Import a private key in PKCS#8 format. More... | |
| virtual bool | importPublicKeyPkcs1IntoTpm (const Name &keyName, const uint8_t *buf, size_t size) |
| Import a public key in PKCS#1 format. More... | |
| void | generateKeyPairInTpmInternal (const Name &keyName, KeyType keyType, int keySize, bool needRetry) |
| void | deleteKeyPairInTpmInternal (const Name &keyName, bool needRetry) |
| ConstBufferPtr | exportPrivateKeyPkcs8FromTpmInternal (const Name &keyName, bool needRetry) |
| bool | importPrivateKeyPkcs8IntoTpmInternal (const Name &keyName, const uint8_t *buf, size_t size, bool needRetry) |
| Block | signInTpmInternal (const uint8_t *data, size_t dataLength, const Name &keyName, DigestAlgorithm digestAlgorithm, bool needRetry) |
| virtual bool | getImpExpPassWord (std::string &password, const std::string &prompt) |
| Get import/export password. More... | |
Definition at line 16 of file sec-tpm-osx.hpp.
| ndn::SecTpmOsx::SecTpmOsx | ( | ) |
Definition at line 116 of file sec-tpm-osx.cpp.
|
virtual |
Definition at line 130 of file sec-tpm-osx.cpp.
|
virtual |
Add the application into the ACL of a particular key.
| keyName | the name of key |
| keyClass | the class of key, e.g. Private Key |
| appPath | the absolute path to the application |
| acl | the new acl of the key |
Implements ndn::SecTpm.
Definition at line 707 of file sec-tpm-osx.cpp.
|
virtual |
Decrypt data.
| data | Pointer to the byte arry to be decrypted. |
| dataLength | The length of data. |
| keyName | The name of the decrypting key. |
| isSymmetric | If true symmetric encryption is used, otherwise asymmetric encryption. |
| SecTpm::Error | if decryption fails. |
Implements ndn::SecTpm.
Definition at line 668 of file sec-tpm-osx.cpp.
|
inlinevirtual |
Delete a key pair of asymmetric keys.
| keyName | The name of the key pair. |
Implements ndn::SecTpm.
Definition at line 64 of file sec-tpm-osx.hpp.
|
protected |
Definition at line 296 of file sec-tpm-osx.cpp.
Check if a particular key exists.
| keyName | The name of the key. |
| keyClass | The class of the key, e.g. KEY_CLASS_PUBLIC, KEY_CLASS_PRIVATE. |
Implements ndn::SecTpm.
Definition at line 785 of file sec-tpm-osx.cpp.
|
virtual |
Encrypt data.
| data | Pointer to the byte arry to be decrypted. |
| dataLength | The length of data. |
| keyName | The name of the encrypting key. |
| isSymmetric | If true symmetric encryption is used, otherwise asymmetric encryption. |
| SecTpm::Error | if encryption fails. |
Implements ndn::SecTpm.
Definition at line 749 of file sec-tpm-osx.cpp.
|
inherited |
Export a private key in PKCS#5 format.
| keyName | The private key name. |
| password | The password to encrypt the private key. |
| SecTpm::Error | if private key cannot be exported. |
Definition at line 17 of file sec-tpm.cpp.
|
inlineprotectedvirtual |
Export a private key in PKCS#8 format.
| keyName | The private key name. |
Implements ndn::SecTpm.
Definition at line 102 of file sec-tpm-osx.hpp.
|
protected |
Definition at line 379 of file sec-tpm-osx.cpp.
|
inlinevirtual |
Generate a pair of asymmetric keys.
| keyName | The name of the key pair. |
| keyType | The type of the key pair, e.g. KEY_TYPE_RSA. |
| keySize | The size of the key pair. |
| SecTpm::Error | if fails. |
Implements ndn::SecTpm.
Definition at line 58 of file sec-tpm-osx.hpp.
|
protected |
Definition at line 245 of file sec-tpm-osx.cpp.
|
virtual |
Generate a random block.
| res | The pointer to the generated block. |
| size | The random block size. |
Implements ndn::SecTpm.
Definition at line 814 of file sec-tpm-osx.cpp.
|
virtual |
Generate a symmetric key.
| keyName | The name of the key. |
| keyType | The type of the key, e.g. KEY_TYPE_AES. |
| keySize | The size of the key. |
| SecTpm::Error | if key generating fails. |
Implements ndn::SecTpm.
Definition at line 323 of file sec-tpm-osx.cpp.
|
inlineprotectedvirtualinherited |
Get import/export password.
| password | On return, the password. |
| prompt | Prompt for password, i.e., "Password for key:" |
Definition at line 279 of file sec-tpm.hpp.
|
virtual |
get inTerminal flag
Implements ndn::SecTpm.
Definition at line 162 of file sec-tpm-osx.cpp.
Get a public key.
| keyName | The public key name. |
| SecTpm::Error | if public key does not exist in TPM. |
Implements ndn::SecTpm.
Definition at line 356 of file sec-tpm-osx.cpp.
|
inherited |
Import a private key in PKCS#5 format.
Also recover the public key and installed it in TPM.
| keyName | The private key name. |
| key | The encoded private key info. |
| password | The password to encrypt the private key. |
Definition at line 139 of file sec-tpm.cpp.
|
inlineprotectedvirtual |
Import a private key in PKCS#8 format.
| keyName | The private key name. |
| key | The encoded private key info. |
Implements ndn::SecTpm.
Definition at line 108 of file sec-tpm-osx.hpp.
|
protected |
Definition at line 441 of file sec-tpm-osx.cpp.
|
protectedvirtual |
Import a public key in PKCS#1 format.
| keyName | The public key name. |
| key | The encoded public key info. |
Implements ndn::SecTpm.
Definition at line 547 of file sec-tpm-osx.cpp.
|
virtual |
check if TPM is locked.
Implements ndn::SecTpm.
Definition at line 168 of file sec-tpm-osx.cpp.
|
virtual |
|
virtual |
set inTerminal flag
If the inTerminal flag is set, and password is not set, TPM may ask for password via terminal. inTerminal flag is set by default.
| inTerminal. |
Implements ndn::SecTpm.
Definition at line 152 of file sec-tpm-osx.cpp.
|
virtual |
set password of TPM
Password is used to unlock TPM when it is locked. You should be cautious when using this method, because remembering password is kind of dangerous.
| password | The password. |
| passwordLength | The length of password. |
Implements ndn::SecTpm.
Definition at line 135 of file sec-tpm-osx.cpp.
|
inlinevirtual |
Sign data.
| data | Pointer to the byte array to be signed. |
| dataLength | The length of data. |
| keyName | The name of the signing key. |
| digestAlgorithm | the digest algorithm. |
| SecTpm::Error | if signing fails. |
Implements ndn::SecTpm.
Definition at line 73 of file sec-tpm-osx.hpp.
|
protected |
Definition at line 594 of file sec-tpm-osx.cpp.
|
virtual |
Unlock the TPM.
| password | The password. |
| passwordLength | The password size. 0 indicates no password. |
| usePassword | True if we want to use the supplied password to unlock the TPM. |
Implements ndn::SecTpm.
Definition at line 180 of file sec-tpm-osx.cpp.