22 #ifndef NDN_MEMORY_PRIVATE_KEY_STORAGE_HPP
23 #define NDN_MEMORY_PRIVATE_KEY_STORAGE_HPP
26 #include "../../lite/security/ec-private-key-lite.hpp"
27 #include "../../lite/security/rsa-private-key-lite.hpp"
28 #include "private-key-storage.hpp"
53 (
const Name& keyName, KeyType keyType,
const uint8_t* publicKeyDer,
54 size_t publicKeyDerLength);
62 (
const Name& keyName,
const uint8_t* publicKeyDer,
size_t publicKeyDerLength)
76 (
const Name& keyName, KeyType keyType,
const uint8_t* privateKeyDer,
77 size_t privateKeyDerLength);
85 (
const Name& keyName,
const uint8_t* privateKeyDer,
size_t privateKeyDerLength)
101 (
const Name& keyName, KeyType keyType,
const uint8_t* publicKeyDer,
102 size_t publicKeyDerLength,
const uint8_t* privateKeyDer,
103 size_t privateKeyDerLength)
115 (
const Name& keyName,
const uint8_t* publicKeyDer,
size_t publicKeyDerLength,
116 const uint8_t* privateKeyDer,
size_t privateKeyDerLength)
119 (keyName, KEY_TYPE_RSA, publicKeyDer, publicKeyDerLength, privateKeyDer,
120 privateKeyDerLength);
143 virtual ptr_lib::shared_ptr<PublicKey>
155 sign(
const uint8_t *data,
size_t dataLength,
const Name& keyName, DigestAlgorithm digestAlgorithm);
166 decrypt(
const Name& keyName,
const uint8_t* data,
size_t dataLength,
bool isSymmetric);
177 encrypt(
const Name& keyName,
const uint8_t* data,
size_t dataLength,
bool isSymmetric);
202 PrivateKey(KeyType keyType,
const uint8_t* keyDer,
size_t keyDerLength);
204 KeyType getKeyType()
const {
return keyType_; }
206 const RsaPrivateKeyLite& getRsaPrivateKey()
const {
return rsaPrivateKey_; }
208 const EcPrivateKeyLite& getEcPrivateKey()
const {
return ecPrivateKey_; }
212 RsaPrivateKeyLite rsaPrivateKey_;
213 EcPrivateKeyLite ecPrivateKey_;
216 std::map<std::string, ptr_lib::shared_ptr<PublicKey> > publicKeyStore_;
217 std::map<std::string, ptr_lib::shared_ptr<PrivateKey> > privateKeyStore_;
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:36
virtual Blob encrypt(const Name &keyName, const uint8_t *data, size_t dataLength, bool isSymmetric)
Encrypt data.
Definition: memory-private-key-storage.cpp:222
virtual void generateKey(const Name &keyName, const KeyParams ¶ms)
Generate a symmetric key.
Definition: memory-private-key-storage.cpp:228
virtual void generateKeyPair(const Name &keyName, const KeyParams ¶ms)
Generate a pair of asymmetric keys.
Definition: memory-private-key-storage.cpp:58
virtual void deleteKeyPair(const Name &keyName)
Delete a pair of asymmetric keys.
Definition: memory-private-key-storage.cpp:161
virtual Blob decrypt(const Name &keyName, const uint8_t *data, size_t dataLength, bool isSymmetric)
Decrypt data.
Definition: memory-private-key-storage.cpp:216
MemoryPrivateKeyStorage extends PrivateKeyStorage to implement a simple in-memory private key store...
Definition: memory-private-key-storage.hpp:36
virtual ptr_lib::shared_ptr< PublicKey > getPublicKey(const Name &keyName)
Get the public key.
Definition: memory-private-key-storage.cpp:170
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:49
A Blob holds a pointer to an immutable byte array implemented as const std::vector.
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:40
KeyParams is a base class for key parameters.
Definition: key-params.hpp:35
virtual ~MemoryPrivateKeyStorage()
The virtual destructor.
Definition: memory-private-key-storage.cpp:34
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:179
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:101
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:234