security: Change in KeyChain creation API
Also, enabling creation of default public/private storages
Change-Id: I77e83b4a7f7e043dce372145d80366b7bc2eb3e0
diff --git a/include/ndn-cpp/security/identity/identity-manager.hpp b/include/ndn-cpp/security/identity/identity-manager.hpp
index 5ed7771..e1c11df 100644
--- a/include/ndn-cpp/security/identity/identity-manager.hpp
+++ b/include/ndn-cpp/security/identity/identity-manager.hpp
@@ -14,11 +14,10 @@
#include "../certificate/public-key.hpp"
#include "../../data.hpp"
+#include "../certificate/identity-certificate.hpp"
namespace ndn {
-class IdentityCertificate;
-
/**
* An IdentityManager is the interface of operations related to identity, keys, and certificates.
*/
@@ -26,8 +25,8 @@
public:
struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} };
- IdentityManager(const ptr_lib::shared_ptr<IdentityStorage> &identityStorage = DefaultIdentityStorage,
- const ptr_lib::shared_ptr<PrivateKeyStorage> &privateKeyStorage = DefaultPrivateKeyStorage);
+ IdentityManager(const ptr_lib::shared_ptr<IdentityStorage> &identityStorage,
+ const ptr_lib::shared_ptr<PrivateKeyStorage> &privateKeyStorage);
inline IdentityStorage&
info();
@@ -261,10 +260,6 @@
void
selfSign (IdentityCertificate& cert);
-public:
- static const ptr_lib::shared_ptr<IdentityStorage> DefaultIdentityStorage;
- static const ptr_lib::shared_ptr<PrivateKeyStorage> DefaultPrivateKeyStorage;
-
private:
/**
* Generate a key pair for the specified identity.
diff --git a/include/ndn-cpp/security/key-chain.hpp b/include/ndn-cpp/security/key-chain.hpp
index c39736e..29bd164 100644
--- a/include/ndn-cpp/security/key-chain.hpp
+++ b/include/ndn-cpp/security/key-chain.hpp
@@ -29,7 +29,8 @@
public:
struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} };
- KeyChain(const ptr_lib::shared_ptr<IdentityManager> &identityManager = DefaultIdentityManager,
+ KeyChain(const ptr_lib::shared_ptr<IdentityStorage> &identityStorage = DefaultIdentityStorage,
+ const ptr_lib::shared_ptr<PrivateKeyStorage> &privateKeyStorage = DefaultPrivateKeyStorage,
const ptr_lib::shared_ptr<PolicyManager> &policyManager = DefaultPolicyManager,
const ptr_lib::shared_ptr<EncryptionManager> &encryptionManager = DefaultEncryptionManager);
@@ -146,7 +147,8 @@
// todo
public:
- static const ptr_lib::shared_ptr<IdentityManager> DefaultIdentityManager;
+ static const ptr_lib::shared_ptr<IdentityStorage> DefaultIdentityStorage;
+ static const ptr_lib::shared_ptr<PrivateKeyStorage> DefaultPrivateKeyStorage;
static const ptr_lib::shared_ptr<PolicyManager> DefaultPolicyManager;
static const ptr_lib::shared_ptr<EncryptionManager> DefaultEncryptionManager;
@@ -161,7 +163,10 @@
const ptr_lib::shared_ptr<Data> &data, ptr_lib::shared_ptr<ValidationRequest> nextStep);
private:
- ptr_lib::shared_ptr<IdentityManager> identityManager_;
+ ptr_lib::shared_ptr<IdentityStorage> publicInfoStorage_;
+ ptr_lib::shared_ptr<PrivateKeyStorage> privateKeyStorage_;
+ ptr_lib::shared_ptr<IdentityManager> identityManager_; // uses publicInfo and privateKey storages
+
ptr_lib::shared_ptr<PolicyManager> policyManager_;
ptr_lib::shared_ptr<EncryptionManager> encryptionManager_;