MemoryPrivateKeyStorage extends PrivateKeyStorage to implement a simple in-memory private key store. More...
#include <memory-private-key-storage.hpp>
Public Member Functions | |
| virtual | ~MemoryPrivateKeyStorage () |
| The virtual destructor. | |
| void | setPublicKeyForKeyName (const Name &keyName, KeyType keyType, const uint8_t *publicKeyDer, size_t publicKeyDerLength) |
| Set the public key for the keyName. More... | |
| void DEPRECATED_IN_NDN_CPP | setPublicKeyForKeyName (const Name &keyName, const uint8_t *publicKeyDer, size_t publicKeyDerLength) |
| void | setPrivateKeyForKeyName (const Name &keyName, KeyType keyType, const uint8_t *privateKeyDer, size_t privateKeyDerLength) |
| Set the private key for the keyName. More... | |
| void DEPRECATED_IN_NDN_CPP | setPrivateKeyForKeyName (const Name &keyName, const uint8_t *privateKeyDer, size_t privateKeyDerLength) |
| void | setKeyPairForKeyName (const Name &keyName, KeyType keyType, const uint8_t *publicKeyDer, size_t publicKeyDerLength, const uint8_t *privateKeyDer, size_t privateKeyDerLength) |
| Set the public and private key for the keyName. More... | |
| void DEPRECATED_IN_NDN_CPP | setKeyPairForKeyName (const Name &keyName, const uint8_t *publicKeyDer, size_t publicKeyDerLength, const uint8_t *privateKeyDer, size_t privateKeyDerLength) |
| virtual void | generateKeyPair (const Name &keyName, const KeyParams ¶ms) |
| Generate a pair of asymmetric keys. More... | |
| virtual void | deleteKeyPair (const Name &keyName) |
| Delete a pair of asymmetric keys. More... | |
| virtual ptr_lib::shared_ptr < PublicKey > | getPublicKey (const Name &keyName) |
| Get the public key. More... | |
| virtual Blob | sign (const uint8_t *data, size_t dataLength, const Name &keyName, DigestAlgorithm digestAlgorithm) |
| Fetch the private key for keyName and sign the data, returning a signature Blob. More... | |
| virtual Blob | decrypt (const Name &keyName, const uint8_t *data, size_t dataLength, bool isSymmetric) |
| Decrypt data. More... | |
| virtual Blob | encrypt (const Name &keyName, const uint8_t *data, size_t dataLength, bool isSymmetric) |
| Encrypt data. More... | |
| virtual void | generateKey (const Name &keyName, const KeyParams ¶ms) |
| Generate a symmetric key. More... | |
| virtual bool | doesKeyExist (const Name &keyName, KeyClass keyClass) |
| Check if a particular key exists. More... | |
Public Member Functions inherited from ndn::PrivateKeyStorage | |
| virtual | ~PrivateKeyStorage () |
| The virtual destructor. | |
| Blob | sign (const Blob &data, const Name &keyName, DigestAlgorithm digestAlgorithm=DIGEST_ALGORITHM_SHA256) |
| Blob | decrypt (const Name &keyName, const Blob &data, bool isSymmetric=false) |
| Blob | encrypt (const Name &keyName, const Blob &data, bool isSymmetric=false) |
MemoryPrivateKeyStorage extends PrivateKeyStorage to implement a simple in-memory private key store.
You should initialize by calling setKeyPairForKeyName.
|
virtual |
Decrypt data.
| keyName | The name of the decrypting key. |
| data | The byte to be decrypted. |
| dataLength | the length of data. |
| isSymmetric | If true symmetric encryption is used, otherwise asymmetric decryption is used. |
Implements ndn::PrivateKeyStorage.
|
virtual |
Delete a pair of asymmetric keys.
If the key doesn't exist, do nothing.
| keyName | The name of the key pair. |
Implements ndn::PrivateKeyStorage.
|
virtual |
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, or KEY_CLASS_SYMMETRIC. |
Implements ndn::PrivateKeyStorage.
|
virtual |
Encrypt data.
| keyName | The name of the encrypting key. |
| data | The byte to be encrypted. |
| dataLength | the length of data. |
| isSymmetric | If true symmetric encryption is used, otherwise asymmetric decryption is used. |
Implements ndn::PrivateKeyStorage.
|
virtual |
Generate a symmetric key.
| keyName | The name of the key. |
| params | The parameters of the key. |
Implements ndn::PrivateKeyStorage.
|
virtual |
Generate a pair of asymmetric keys.
| keyName | The name of the key pair. |
| params | The parameters of the key. |
Implements ndn::PrivateKeyStorage.
|
virtual |
Get the public key.
| keyName | The name of public key. |
Implements ndn::PrivateKeyStorage.
|
inline |
Set the public and private key for the keyName.
| keyName | The key name. |
| keyType | The KeyType, such as KEY_TYPE_RSA. |
| publicKeyDer | The public key DER byte array. |
| publicKeyDerLength | The length of publicKeyDer. |
| privateKeyDer | The private key DER byte array. |
| privateKeyDerLength | The length of privateKeyDer. |
|
inline |
| void ndn::MemoryPrivateKeyStorage::setPrivateKeyForKeyName | ( | const Name & | keyName, |
| KeyType | keyType, | ||
| const uint8_t * | privateKeyDer, | ||
| size_t | privateKeyDerLength | ||
| ) |
Set the private key for the keyName.
| keyName | The key name. |
| keyType | The KeyType, such as KEY_TYPE_RSA. |
| privateKeyDer | The private key DER byte array. |
| privateKeyDerLength | The length of privateKeyDer. |
|
inline |
| void ndn::MemoryPrivateKeyStorage::setPublicKeyForKeyName | ( | const Name & | keyName, |
| KeyType | keyType, | ||
| const uint8_t * | publicKeyDer, | ||
| size_t | publicKeyDerLength | ||
| ) |
Set the public key for the keyName.
| keyName | The key name. |
| keyType | The KeyType, such as KEY_TYPE_RSA. |
| publicKeyDer | The public key DER byte array. |
| publicKeyDerLength | The length of publicKeyDer. |
|
inline |
|
virtual |
Fetch the private key for keyName and sign the data, returning a signature Blob.
| data | Pointer to the input byte array. |
| dataLength | The length of data. |
| keyName | The name of the signing key. |
| digestAlgorithm | the digest algorithm. |
Implements ndn::PrivateKeyStorage.
1.8.6