FilePrivateKeyStorage extends PrivateKeyStorage to implement private key storage using files.
More...
#include <file-private-key-storage.hpp>
|
|
| FilePrivateKeyStorage () |
| | Create a new FilePrivateKeyStorage to connect to the default directory.
|
| |
|
virtual | ~FilePrivateKeyStorage () |
| | The virtual Destructor.
|
| |
| 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=DIGEST_ALGORITHM_SHA256) |
| | 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=false) |
| | Decrypt data. More...
|
| |
| virtual Blob | encrypt (const Name &keyName, const uint8_t *data, size_t dataLength, bool isSymmetric=false) |
| | 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...
|
| |
|
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) |
| |
|
| static Blob | encodePkcs8PrivateKey (const std::vector< uint8_t > &privateKeyDer, const OID &oid, const ptr_lib::shared_ptr< DerNode > ¶meters) |
| | Encode the private key to a PKCS #8 private key. More...
|
| |
| static Blob | encodeSubjectPublicKeyInfo (const OID &oid, const ptr_lib::shared_ptr< DerNode > ¶meters, const ptr_lib::shared_ptr< DerNode > &bitString) |
| | Encode the bitString into a SubjectPublicKeyInfo. More...
|
| |
| static ec_key_st * | decodeEcPrivateKey (const ptr_lib::shared_ptr< DerNode > &algorithmParameters, const Blob &privateKeyDer) |
| | Create an EC key using the curve in the algorithmParameters, decode the privateKeyDer and set the private key value. More...
|
| |
FilePrivateKeyStorage extends PrivateKeyStorage to implement private key storage using files.
| Blob ndn::FilePrivateKeyStorage::decrypt |
( |
const Name & |
keyName, |
|
|
const uint8_t * |
data, |
|
|
size_t |
dataLength, |
|
|
bool |
isSymmetric = false |
|
) |
| |
|
virtual |
Decrypt data.
- Parameters
-
| 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 encryption is used. |
- Returns
- The decrypted data.
Implements ndn::PrivateKeyStorage.
| void ndn::FilePrivateKeyStorage::deleteKeyPair |
( |
const Name & |
keyName | ) |
|
|
virtual |
Delete a pair of asymmetric keys.
If the key doesn't exist, do nothing.
- Parameters
-
| keyName | The name of the key pair. |
Implements ndn::PrivateKeyStorage.
| bool ndn::FilePrivateKeyStorage::doesKeyExist |
( |
const Name & |
keyName, |
|
|
KeyClass |
keyClass |
|
) |
| |
|
virtual |
Check if a particular key exists.
- Parameters
-
| keyName | The name of the key. |
| keyClass | The class of the key, e.g. KEY_CLASS_PUBLIC, KEY_CLASS_PRIVATE, or KEY_CLASS_SYMMETRIC. |
- Returns
- True if the key exists, otherwise false.
Implements ndn::PrivateKeyStorage.
| Blob ndn::FilePrivateKeyStorage::encrypt |
( |
const Name & |
keyName, |
|
|
const uint8_t * |
data, |
|
|
size_t |
dataLength, |
|
|
bool |
isSymmetric = false |
|
) |
| |
|
virtual |
Encrypt data.
- Parameters
-
| 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 encryption is used. |
- Returns
- The encrypted data.
Implements ndn::PrivateKeyStorage.
| void ndn::FilePrivateKeyStorage::generateKey |
( |
const Name & |
keyName, |
|
|
const KeyParams & |
params |
|
) |
| |
|
virtual |
Generate a symmetric key.
- Parameters
-
| keyName | The name of the key. |
| params | The parameters of the key. |
Implements ndn::PrivateKeyStorage.
| void ndn::FilePrivateKeyStorage::generateKeyPair |
( |
const Name & |
keyName, |
|
|
const KeyParams & |
params |
|
) |
| |
|
virtual |
Generate a pair of asymmetric keys.
- Parameters
-
| keyName | The name of the key pair. |
| params | The parameters of the key. |
Implements ndn::PrivateKeyStorage.
| ptr_lib::shared_ptr< PublicKey > ndn::FilePrivateKeyStorage::getPublicKey |
( |
const Name & |
keyName | ) |
|
|
virtual |
Get the public key.
- Parameters
-
| keyName | The name of public key. |
- Returns
- The public key.
Implements ndn::PrivateKeyStorage.
| Blob ndn::FilePrivateKeyStorage::sign |
( |
const uint8_t * |
data, |
|
|
size_t |
dataLength, |
|
|
const Name & |
keyName, |
|
|
DigestAlgorithm |
digestAlgorithm = DIGEST_ALGORITHM_SHA256 |
|
) |
| |
|
virtual |
Fetch the private key for keyName and sign the data, returning a signature Blob.
- Parameters
-
| data | Pointer to the input byte array. |
| dataLength | The length of data. |
| keyName | The name of the signing key. |
| digestAlgorithm | the digest algorithm. |
- Returns
- The signature Blob.
Implements ndn::PrivateKeyStorage.
The documentation for this class was generated from the following files: