|
virtual | ~PrivateKeyStorage () |
| The virtual destructor.
|
|
virtual void | generateKeyPair (const Name &keyName, const KeyParams ¶ms)=0 |
| Generate a pair of asymmetric keys. More...
|
|
virtual void | deleteKeyPair (const Name &keyName)=0 |
| Delete a pair of asymmetric keys. More...
|
|
virtual ptr_lib::shared_ptr< PublicKey > | getPublicKey (const Name &keyName)=0 |
| Get the public key. More...
|
|
virtual Blob | sign (const uint8_t *data, size_t dataLength, const Name &keyName, DigestAlgorithm digestAlgorithm=DIGEST_ALGORITHM_SHA256)=0 |
| Fetch the private key for keyName and sign the data, returning a signature Blob. More...
|
|
Blob | sign (const Blob &data, const Name &keyName, DigestAlgorithm digestAlgorithm=DIGEST_ALGORITHM_SHA256) |
|
virtual Blob | decrypt (const Name &keyName, const uint8_t *data, size_t dataLength, bool isSymmetric=false)=0 |
| Decrypt data. More...
|
|
Blob | decrypt (const Name &keyName, const Blob &data, bool isSymmetric=false) |
|
virtual Blob | encrypt (const Name &keyName, const uint8_t *data, size_t dataLength, bool isSymmetric=false)=0 |
| Encrypt data. More...
|
|
Blob | encrypt (const Name &keyName, const Blob &data, bool isSymmetric=false) |
|
virtual void | generateKey (const Name &keyName, const KeyParams ¶ms)=0 |
| Generate a symmetric key. More...
|
|
virtual bool | doesKeyExist (const Name &keyName, KeyClass keyClass)=0 |
| Check if a particular key exists. More...
|
|
|
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...
|
|
static ec_key_st* ndn::PrivateKeyStorage::decodeEcPrivateKey |
( |
const ptr_lib::shared_ptr< DerNode > & |
algorithmParameters, |
|
|
const Blob & |
privateKeyDer |
|
) |
| |
|
staticprotected |
Create an EC key using the curve in the algorithmParameters, decode the privateKeyDer and set the private key value.
This is necessary because d2i_ECPrivateKey does not seem to work with the "parameterless" private key encoding produced by NFD.
- Parameters
-
algorithmParameters | The parameters from the PKCS #8 AlgorithmIdentifier. |
privateKeyDer | The bytes of the inner PKCS #8 private key. |
- Returns
- A new ec_key_st. You must call EC_KEY_free.
- Exceptions
-
virtual Blob ndn::PrivateKeyStorage::decrypt |
( |
const Name & |
keyName, |
|
|
const uint8_t * |
data, |
|
|
size_t |
dataLength, |
|
|
bool |
isSymmetric = false |
|
) |
| |
|
pure 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.
Implemented in ndn::MemoryPrivateKeyStorage, and ndn::FilePrivateKeyStorage.
virtual void ndn::PrivateKeyStorage::deleteKeyPair |
( |
const Name & |
keyName | ) |
|
|
pure virtual |
virtual bool ndn::PrivateKeyStorage::doesKeyExist |
( |
const Name & |
keyName, |
|
|
KeyClass |
keyClass |
|
) |
| |
|
pure 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.
Implemented in ndn::MemoryPrivateKeyStorage, and ndn::FilePrivateKeyStorage.
Blob ndn::PrivateKeyStorage::encodePkcs8PrivateKey |
( |
const std::vector< uint8_t > & |
privateKeyDer, |
|
|
const OID & |
oid, |
|
|
const ptr_lib::shared_ptr< DerNode > & |
parameters |
|
) |
| |
|
staticprotected |
Encode the private key to a PKCS #8 private key.
We do this explicitly here to avoid linking to extra OpenSSL libraries.
- Parameters
-
privateKeyDer | The input private key DER. |
oid | The OID of the privateKey. |
parameters | The DerNode of the parameters for the OID. |
- Returns
- The PKCS #8 private key DER.
Blob ndn::PrivateKeyStorage::encodeSubjectPublicKeyInfo |
( |
const OID & |
oid, |
|
|
const ptr_lib::shared_ptr< DerNode > & |
parameters, |
|
|
const ptr_lib::shared_ptr< DerNode > & |
bitString |
|
) |
| |
|
staticprotected |
Encode the bitString into a SubjectPublicKeyInfo.
- Parameters
-
- Returns
- The subject public key info DER.
virtual Blob ndn::PrivateKeyStorage::encrypt |
( |
const Name & |
keyName, |
|
|
const uint8_t * |
data, |
|
|
size_t |
dataLength, |
|
|
bool |
isSymmetric = false |
|
) |
| |
|
pure 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.
Implemented in ndn::MemoryPrivateKeyStorage, and ndn::FilePrivateKeyStorage.
virtual void ndn::PrivateKeyStorage::generateKey |
( |
const Name & |
keyName, |
|
|
const KeyParams & |
params |
|
) |
| |
|
pure virtual |
virtual void ndn::PrivateKeyStorage::generateKeyPair |
( |
const Name & |
keyName, |
|
|
const KeyParams & |
params |
|
) |
| |
|
pure virtual |
virtual ptr_lib::shared_ptr<PublicKey> ndn::PrivateKeyStorage::getPublicKey |
( |
const Name & |
keyName | ) |
|
|
pure virtual |
virtual Blob ndn::PrivateKeyStorage::sign |
( |
const uint8_t * |
data, |
|
|
size_t |
dataLength, |
|
|
const Name & |
keyName, |
|
|
DigestAlgorithm |
digestAlgorithm = DIGEST_ALGORITHM_SHA256 |
|
) |
| |
|
pure 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.
Implemented in ndn::MemoryPrivateKeyStorage, and ndn::FilePrivateKeyStorage.
The documentation for this class was generated from the following files: