22 #ifndef NDN_MEMORY_PRIVATE_KEY_STORAGE_HPP
23 #define NDN_MEMORY_PRIVATE_KEY_STORAGE_HPP
26 #include "private-key-storage.hpp"
54 (
const Name& keyName, KeyType keyType,
const uint8_t* publicKeyDer,
55 size_t publicKeyDerLength);
63 (
const Name& keyName,
const uint8_t* publicKeyDer,
size_t publicKeyDerLength)
77 (
const Name& keyName, KeyType keyType,
const uint8_t* privateKeyDer,
78 size_t privateKeyDerLength);
86 (
const Name& keyName,
const uint8_t* privateKeyDer,
size_t privateKeyDerLength)
102 (
const Name& keyName, KeyType keyType,
const uint8_t* publicKeyDer,
103 size_t publicKeyDerLength,
const uint8_t* privateKeyDer,
104 size_t privateKeyDerLength)
116 (
const Name& keyName,
const uint8_t* publicKeyDer,
size_t publicKeyDerLength,
117 const uint8_t* privateKeyDer,
size_t privateKeyDerLength)
120 (keyName, KEY_TYPE_RSA, publicKeyDer, publicKeyDerLength, privateKeyDer,
121 privateKeyDerLength);
144 virtual ptr_lib::shared_ptr<PublicKey>
156 sign(
const uint8_t *data,
size_t dataLength,
const Name& keyName, DigestAlgorithm digestAlgorithm);
167 decrypt(
const Name& keyName,
const uint8_t* data,
size_t dataLength,
bool isSymmetric);
178 encrypt(
const Name& keyName,
const uint8_t* data,
size_t dataLength,
bool isSymmetric);
203 PrivateKey(KeyType keyType,
const uint8_t* keyDer,
size_t keyDerLength);
207 KeyType getKeyType()
const {
return keyType_; }
209 struct rsa_st* getRsaPrivateKey()
const {
return rsaPrivateKey_; }
211 struct ec_key_st* getEcPrivateKey()
const {
return ecPrivateKey_; }
215 struct rsa_st* rsaPrivateKey_;
216 struct ec_key_st* ecPrivateKey_;
219 std::map<std::string, ptr_lib::shared_ptr<PublicKey> > publicKeyStore_;
220 std::map<std::string, ptr_lib::shared_ptr<PrivateKey> > privateKeyStore_;
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:35
virtual Blob encrypt(const Name &keyName, const uint8_t *data, size_t dataLength, bool isSymmetric)
Encrypt data.
Definition: memory-private-key-storage.cpp:226
virtual void generateKey(const Name &keyName, const KeyParams ¶ms)
Generate a symmetric key.
Definition: memory-private-key-storage.cpp:232
virtual void generateKeyPair(const Name &keyName, const KeyParams ¶ms)
Generate a pair of asymmetric keys.
Definition: memory-private-key-storage.cpp:62
virtual void deleteKeyPair(const Name &keyName)
Delete a pair of asymmetric keys.
Definition: memory-private-key-storage.cpp:166
virtual Blob decrypt(const Name &keyName, const uint8_t *data, size_t dataLength, bool isSymmetric)
Decrypt data.
Definition: memory-private-key-storage.cpp:220
MemoryPrivateKeyStorage extends PrivateKeyStorage to implement a simple in-memory private key store...
Definition: memory-private-key-storage.hpp:37
virtual ptr_lib::shared_ptr< PublicKey > getPublicKey(const Name &keyName)
Get the public key.
Definition: memory-private-key-storage.cpp:175
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:53
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:44
KeyParams is a base class for key parameters.
Definition: key-params.hpp:34
virtual ~MemoryPrivateKeyStorage()
The virtual destructor.
Definition: memory-private-key-storage.cpp:38
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:184
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:102
Definition: private-key-storage.hpp:40
virtual bool doesKeyExist(const Name &keyName, KeyClass keyClass)
Check if a particular key exists.
Definition: memory-private-key-storage.cpp:238