All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | List of all members
ndn::PrivateKeyStorage Class Referenceabstract
Inheritance diagram for ndn::PrivateKeyStorage:
ndn::FilePrivateKeyStorage ndn::MemoryPrivateKeyStorage

Public Member Functions

virtual ~PrivateKeyStorage ()
 The virtual destructor.
 
virtual void generateKeyPair (const Name &keyName, const KeyParams &params)=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 &params)=0
 Generate a symmetric key. More...
 
virtual bool doesKeyExist (const Name &keyName, KeyClass keyClass)=0
 Check if a particular key exists. More...
 

Member Function Documentation

virtual Blob ndn::PrivateKeyStorage::decrypt ( const Name keyName,
const uint8_t *  data,
size_t  dataLength,
bool  isSymmetric = false 
)
pure virtual

Decrypt data.

Parameters
keyNameThe name of the decrypting key.
dataThe byte to be decrypted.
dataLengththe length of data.
isSymmetricIf 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

Delete a pair of asymmetric keys.

If the key doesn't exist, do nothing.

Parameters
keyNameThe name of the key pair.

Implemented in ndn::MemoryPrivateKeyStorage, and ndn::FilePrivateKeyStorage.

virtual bool ndn::PrivateKeyStorage::doesKeyExist ( const Name keyName,
KeyClass  keyClass 
)
pure virtual

Check if a particular key exists.

Parameters
keyNameThe name of the key.
keyClassThe 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.

virtual Blob ndn::PrivateKeyStorage::encrypt ( const Name keyName,
const uint8_t *  data,
size_t  dataLength,
bool  isSymmetric = false 
)
pure virtual

Encrypt data.

Parameters
keyNameThe name of the encrypting key.
dataThe byte to be encrypted.
dataLengththe length of data.
isSymmetricIf 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

Generate a symmetric key.

Parameters
keyNameThe name of the key.
paramsThe parameters of the key.

Implemented in ndn::MemoryPrivateKeyStorage, and ndn::FilePrivateKeyStorage.

virtual void ndn::PrivateKeyStorage::generateKeyPair ( const Name keyName,
const KeyParams params 
)
pure virtual

Generate a pair of asymmetric keys.

Parameters
keyNameThe name of the key pair.
paramsThe parameters of the key.

Implemented in ndn::MemoryPrivateKeyStorage, and ndn::FilePrivateKeyStorage.

virtual ptr_lib::shared_ptr<PublicKey> ndn::PrivateKeyStorage::getPublicKey ( const Name keyName)
pure virtual

Get the public key.

Parameters
keyNameThe name of public key.
Returns
The public key.

Implemented in ndn::MemoryPrivateKeyStorage, and ndn::FilePrivateKeyStorage.

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
dataPointer to the input byte array.
dataLengthThe length of data.
keyNameThe name of the signing key.
digestAlgorithmthe digest algorithm.
Returns
The signature Blob.

Implemented in ndn::MemoryPrivateKeyStorage, and ndn::FilePrivateKeyStorage.


The documentation for this class was generated from the following files: