23 #ifndef NDN_FILE_PRIVATE_KEY_STORAGE_HPP
24 #define NDN_FILE_PRIVATE_KEY_STORAGE_HPP
27 #include <ndn-cpp/encoding/oid.hpp>
28 #include "private-key-storage.hpp"
73 virtual ptr_lib::shared_ptr<PublicKey>
85 sign(
const uint8_t *data,
size_t dataLength,
const Name& keyName, DigestAlgorithm digestAlgorithm = DIGEST_ALGORITHM_SHA256);
96 decrypt(
const Name& keyName,
const uint8_t* data,
size_t dataLength,
bool isSymmetric =
false);
107 encrypt(
const Name& keyName,
const uint8_t* data,
size_t dataLength,
bool isSymmetric =
false);
128 nameTransform(
const std::string& keyName,
const std::string& extension);
139 encodePkcs8PrivateKey
140 (
const std::vector<uint8_t>& privateKeyDer,
const OID& oid,
141 const ptr_lib::shared_ptr<DerNode>& parameters);
152 encodeSubjectPublicKeyInfo
153 (
const OID& oid,
const ptr_lib::shared_ptr<DerNode>& parameters,
154 const ptr_lib::shared_ptr<DerNode>& bitString);
168 (
const ptr_lib::shared_ptr<DerNode>& algorithmParameters,
169 const Blob& privateKeyDer);
171 std::string keyStorePath_;
virtual Blob decrypt(const Name &keyName, const uint8_t *data, size_t dataLength, bool isSymmetric=false)
Decrypt data.
Definition: file-private-key-storage.cpp:356
Copyright (C) 2013-2015 Regents of the University of California.
Definition: common.hpp:35
FilePrivateKeyStorage extends PrivateKeyStorage to implement private key storage using files...
Definition: file-private-key-storage.hpp:40
virtual ~FilePrivateKeyStorage()
The virtual Destructor.
Definition: file-private-key-storage.cpp:135
virtual void generateKey(const Name &keyName, const KeyParams ¶ms)
Generate a symmetric key.
Definition: file-private-key-storage.cpp:375
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:42
virtual bool doesKeyExist(const Name &keyName, KeyClass keyClass)
Check if a particular key exists.
Definition: file-private-key-storage.cpp:383
A Blob holds a pointer to an immutable byte array implemented as const std::vector.
Definition: blob.hpp:42
virtual ptr_lib::shared_ptr< PublicKey > getPublicKey(const Name &keyName)
Get the public key.
Definition: file-private-key-storage.cpp:258
virtual void generateKeyPair(const Name &keyName, const KeyParams ¶ms)
Generate a pair of asymmetric keys.
Definition: file-private-key-storage.cpp:141
virtual Blob encrypt(const Name &keyName, const uint8_t *data, size_t dataLength, bool isSymmetric=false)
Encrypt data.
Definition: file-private-key-storage.cpp:366
KeyParams is a base class for key parameters.
Definition: key-params.hpp:34
FilePrivateKeyStorage()
Create a new FilePrivateKeyStorage to connect to the default directory.
Definition: file-private-key-storage.cpp:116
virtual void deleteKeyPair(const Name &keyName)
Delete a pair of asymmetric keys.
Definition: file-private-key-storage.cpp:249
Definition: private-key-storage.hpp:35
virtual Blob sign(const uint8_t *data, size_t dataLength, const Name &keyName, DigestAlgorithm digestAlgorithm=DIGEST_ALGORITHM_SHA256)
Fetch the private key for keyName and sign the data, returning a signature Blob.
Definition: file-private-key-storage.cpp:279