security: Make the KeyChain constructor take an IdentityManager.
diff --git a/ndn-cpp/security/key-chain.cpp b/ndn-cpp/security/key-chain.cpp
index fdfc998..8025b68 100644
--- a/ndn-cpp/security/key-chain.cpp
+++ b/ndn-cpp/security/key-chain.cpp
@@ -31,8 +31,8 @@
};
#endif
-KeyChain::KeyChain(const ptr_lib::shared_ptr<IdentityStorage>& identityStorage, const ptr_lib::shared_ptr<PrivateKeyStorage>& privateKeyStorage)
-: identityManager_(identityStorage, privateKeyStorage), face_(0), maxSteps_(100)
+KeyChain::KeyChain(const shared_ptr<IdentityManager>& identityManager)
+: identityManager_(identityManager), face_(0), maxSteps_(100)
{
}
@@ -105,7 +105,7 @@
if (certificateNameIn.getComponentCount() == 0) {
#if 0
- inferredCertificateName = identityManager_.getDefaultCertificateNameForIdentity(policyManager_->inferSigningIdentity(data.getName ()));
+ inferredCertificateName = identityManager_->getDefaultCertificateNameForIdentity(policyManager_->inferSigningIdentity(data.getName ()));
#else
inferredCertificateName = Name();
#endif
@@ -122,7 +122,7 @@
throw SecurityException("Signing Cert name does not comply with signing policy");
#endif
- identityManager_.signByCertificate(data, *certificateName, wireFormat);
+ identityManager_->signByCertificate(data, *certificateName, wireFormat);
}
void
diff --git a/ndn-cpp/security/key-chain.hpp b/ndn-cpp/security/key-chain.hpp
index d0357ef..ecddf67 100644
--- a/ndn-cpp/security/key-chain.hpp
+++ b/ndn-cpp/security/key-chain.hpp
@@ -31,7 +31,7 @@
*/
class KeyChain {
public:
- KeyChain(const ptr_lib::shared_ptr<IdentityStorage>& identityStorage, const ptr_lib::shared_ptr<PrivateKeyStorage>& privateKeyStorage);
+ KeyChain(const ptr_lib::shared_ptr<IdentityManager>& identityManager);
/**
* Get the default certificate name for the specified identity, which will be used when signing is performed based on identity.
@@ -41,7 +41,7 @@
Name
getDefaultCertificateNameForIdentity(const Name& identityName)
{
- return identityManager_.getDefaultCertificateNameForIdentity(identityName);
+ return identityManager_->getDefaultCertificateNameForIdentity(identityName);
}
/**
@@ -88,7 +88,7 @@
setFace(Face* face) { face_ = face; }
private:
- IdentityManager identityManager_;
+ ptr_lib::shared_ptr<IdentityManager> identityManager_;
Face* face_;
const int maxSteps_;
};