22 #ifndef NDN_MEMORY_PRIVATE_KEY_STORAGE_HPP
23 #define NDN_MEMORY_PRIVATE_KEY_STORAGE_HPP
26 #include "../tpm/tpm-private-key.hpp"
27 #include "private-key-storage.hpp"
52 (
const Name& keyName,
KeyType keyType,
const uint8_t* publicKeyDer,
53 size_t publicKeyDerLength);
61 (
const Name& keyName,
const uint8_t* publicKeyDer,
size_t publicKeyDerLength)
75 (
const Name& keyName,
KeyType keyType,
const uint8_t* privateKeyDer,
76 size_t privateKeyDerLength);
84 (
const Name& keyName,
const uint8_t* privateKeyDer,
size_t privateKeyDerLength)
100 (
const Name& keyName,
KeyType keyType,
const uint8_t* publicKeyDer,
101 size_t publicKeyDerLength,
const uint8_t* privateKeyDer,
102 size_t privateKeyDerLength)
114 (
const Name& keyName,
const uint8_t* publicKeyDer,
size_t publicKeyDerLength,
115 const uint8_t* privateKeyDer,
size_t privateKeyDerLength)
118 (keyName, KEY_TYPE_RSA, publicKeyDer, publicKeyDerLength, privateKeyDer,
119 privateKeyDerLength);
142 virtual ptr_lib::shared_ptr<PublicKey>
154 sign(
const uint8_t *data,
size_t dataLength,
const Name& keyName, DigestAlgorithm digestAlgorithm);
165 decrypt(
const Name& keyName,
const uint8_t* data,
size_t dataLength,
bool isSymmetric);
176 encrypt(
const Name& keyName,
const uint8_t* data,
size_t dataLength,
bool isSymmetric);
197 std::map<std::string, ptr_lib::shared_ptr<PublicKey> > publicKeyStore_;
198 std::map<std::string, ptr_lib::shared_ptr<TpmPrivateKey> > privateKeyStore_;
virtual Blob encrypt(const Name &keyName, const uint8_t *data, size_t dataLength, bool isSymmetric)
Encrypt data.
Definition: memory-private-key-storage.cpp:118
virtual void generateKey(const Name &keyName, const KeyParams ¶ms)
Generate a symmetric key.
Definition: memory-private-key-storage.cpp:124
virtual void generateKeyPair(const Name &keyName, const KeyParams ¶ms)
Generate a pair of asymmetric keys.
Definition: memory-private-key-storage.cpp:59
virtual void deleteKeyPair(const Name &keyName)
Delete a pair of asymmetric keys.
Definition: memory-private-key-storage.cpp:78
virtual Blob decrypt(const Name &keyName, const uint8_t *data, size_t dataLength, bool isSymmetric)
Decrypt data.
Definition: memory-private-key-storage.cpp:112
MemoryPrivateKeyStorage extends PrivateKeyStorage to implement a simple in-memory private key store...
Definition: memory-private-key-storage.hpp:35
KeyType
Definition: security-common.hpp:50
virtual ptr_lib::shared_ptr< PublicKey > getPublicKey(const Name &keyName)
Get the public key.
Definition: memory-private-key-storage.cpp:87
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:40
void setPrivateKeyForKeyName(const Name &keyName, KeyType keyType, const uint8_t *privateKeyDer, size_t privateKeyDerLength)
Set the private key for the keyName.
Definition: memory-private-key-storage.cpp:45
A Blob holds a pointer to an immutable byte array implemented as const std::vector<uint8_t>.
Definition: blob.hpp:42
void setPublicKeyForKeyName(const Name &keyName, KeyType keyType, const uint8_t *publicKeyDer, size_t publicKeyDerLength)
Set the public key for the keyName.
Definition: memory-private-key-storage.cpp:36
KeyParams is a base class for key parameters.
Definition: key-params.hpp:36
virtual ~MemoryPrivateKeyStorage()
The virtual destructor.
Definition: memory-private-key-storage.cpp:30
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.
Definition: memory-private-key-storage.cpp:96
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.
Definition: memory-private-key-storage.hpp:100
Definition: private-key-storage.hpp:39
virtual bool doesKeyExist(const Name &keyName, KeyClass keyClass)
Check if a particular key exists.
Definition: memory-private-key-storage.cpp:130