security: renaming PolicyManager classess to SecPolicy___ and re-organize security file layout
Change-Id: Ibca0333129a3d4465ff294c4d97d59808ae253f4
diff --git a/src/security/certificate/certificate-extension.cpp b/src/security/certificate-extension.cpp
similarity index 96%
rename from src/security/certificate/certificate-extension.cpp
rename to src/security/certificate-extension.cpp
index daa1e52..5494a2c 100644
--- a/src/security/certificate/certificate-extension.cpp
+++ b/src/security/certificate-extension.cpp
@@ -18,7 +18,7 @@
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
-#include <ndn-cpp/security/certificate/certificate-extension.hpp>
+#include <ndn-cpp/security/certificate-extension.hpp>
#include <cryptopp/asn.h>
using namespace std;
diff --git a/src/security/certificate/certificate-subject-description.cpp b/src/security/certificate-subject-description.cpp
similarity index 96%
rename from src/security/certificate/certificate-subject-description.cpp
rename to src/security/certificate-subject-description.cpp
index ed62b82..3dc46f5 100644
--- a/src/security/certificate/certificate-subject-description.cpp
+++ b/src/security/certificate-subject-description.cpp
@@ -18,7 +18,7 @@
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
-#include <ndn-cpp/security/certificate/certificate-subject-description.hpp>
+#include <ndn-cpp/security/certificate-subject-description.hpp>
#include <cryptopp/asn.h>
using namespace std;
diff --git a/src/security/certificate/certificate.cpp b/src/security/certificate.cpp
similarity index 97%
rename from src/security/certificate/certificate.cpp
rename to src/security/certificate.cpp
index 1708f70..3f87c9c 100644
--- a/src/security/certificate/certificate.cpp
+++ b/src/security/certificate.cpp
@@ -20,16 +20,16 @@
#include <ndn-cpp/common.hpp>
-#include <ndn-cpp/security/certificate/certificate.hpp>
+#include <ndn-cpp/security/certificate.hpp>
-#include "../../util/logging.hpp"
-#include "../../util/time.hpp"
+#include "../util/logging.hpp"
+#include "../util/time.hpp"
#include <cryptopp/asn.h>
#include <cryptopp/base64.h>
#include <cryptopp/files.h>
-#include "../../encoding/cryptopp/asn_ext.hpp"
+#include "../encoding/cryptopp/asn_ext.hpp"
INIT_LOGGER("ndn.security.Certificate");
diff --git a/src/security/certificate/identity-certificate.cpp b/src/security/identity-certificate.cpp
similarity index 96%
rename from src/security/certificate/identity-certificate.cpp
rename to src/security/identity-certificate.cpp
index 1deb46f..4f9f9c8 100644
--- a/src/security/certificate/identity-certificate.cpp
+++ b/src/security/identity-certificate.cpp
@@ -6,7 +6,7 @@
* See COPYING for copyright and distribution information.
*/
-#include <ndn-cpp/security/certificate/identity-certificate.hpp>
+#include <ndn-cpp/security/identity-certificate.hpp>
using namespace std;
diff --git a/src/security/certificate/public-key.cpp b/src/security/public-key.cpp
similarity index 98%
rename from src/security/certificate/public-key.cpp
rename to src/security/public-key.cpp
index 3d178d0..2923ece 100644
--- a/src/security/certificate/public-key.cpp
+++ b/src/security/public-key.cpp
@@ -19,7 +19,7 @@
#endif
#include <ndn-cpp/common.hpp>
-#include <ndn-cpp/security/certificate/public-key.hpp>
+#include <ndn-cpp/security/public-key.hpp>
#include <cryptopp/rsa.h>
#include <cryptopp/base64.h>
diff --git a/src/security/policy/no-verify-policy-manager.cpp b/src/security/sec-policy-no-verify.cpp
similarity index 61%
rename from src/security/policy/no-verify-policy-manager.cpp
rename to src/security/sec-policy-no-verify.cpp
index b93bdb6..c2f7866 100644
--- a/src/security/policy/no-verify-policy-manager.cpp
+++ b/src/security/sec-policy-no-verify.cpp
@@ -6,30 +6,30 @@
* See COPYING for copyright and distribution information.
*/
-#include <ndn-cpp/security/policy/no-verify-policy-manager.hpp>
+#include <ndn-cpp/security/sec-policy-no-verify.hpp>
using namespace std;
namespace ndn {
-NoVerifyPolicyManager::~NoVerifyPolicyManager()
+SecPolicyNoVerify::~SecPolicyNoVerify()
{
}
bool
-NoVerifyPolicyManager::skipVerifyAndTrust(const Data& data)
+SecPolicyNoVerify::skipVerifyAndTrust(const Data& data)
{
return true;
}
bool
-NoVerifyPolicyManager::requireVerify(const Data& data)
+SecPolicyNoVerify::requireVerify(const Data& data)
{
return false;
}
ptr_lib::shared_ptr<ValidationRequest>
-NoVerifyPolicyManager::checkVerificationPolicy
+SecPolicyNoVerify::checkVerificationPolicy
(const ptr_lib::shared_ptr<Data>& data, int stepCount, const OnVerified& onVerified, const OnVerifyFailed& onVerifyFailed)
{
onVerified(data);
@@ -37,13 +37,13 @@
}
bool
-NoVerifyPolicyManager::checkSigningPolicy(const Name& dataName, const Name& certificateName)
+SecPolicyNoVerify::checkSigningPolicy(const Name& dataName, const Name& certificateName)
{
return true;
}
Name
-NoVerifyPolicyManager::inferSigningIdentity(const Name& dataName)
+SecPolicyNoVerify::inferSigningIdentity(const Name& dataName)
{
return Name();
}
diff --git a/src/security/policy/self-verify-policy-manager.cpp b/src/security/sec-policy-self-verify.cpp
similarity index 84%
rename from src/security/policy/self-verify-policy-manager.cpp
rename to src/security/sec-policy-self-verify.cpp
index 5c189c5..6d2081c 100644
--- a/src/security/policy/self-verify-policy-manager.cpp
+++ b/src/security/sec-policy-self-verify.cpp
@@ -8,11 +8,9 @@
#ifdef TEMPRORARILY_DISABLED
-#include "../../c/util/crypto.h"
-#include <ndn-cpp/sha256-with-rsa-signature.hpp>
-#include <ndn-cpp/security/security-exception.hpp>
-#include <ndn-cpp/security/identity/identity-storage.hpp>
-#include <ndn-cpp/security/policy/self-verify-policy-manager.hpp>
+#include "../c/util/crypto.h"
+#include <ndn-cpp/security/identity-storage.hpp>
+#include <ndn-cpp/security/sec-policy-self-verify.hpp>
using namespace std;
@@ -62,30 +60,30 @@
return (success == 1);
}
-SelfVerifyPolicyManager::~SelfVerifyPolicyManager()
+SecPolicySelfVerify::~SecPolicySelfVerify()
{
}
bool
-SelfVerifyPolicyManager::skipVerifyAndTrust(const Data& data)
+SecPolicySelfVerify::skipVerifyAndTrust(const Data& data)
{
return false;
}
bool
-SelfVerifyPolicyManager::requireVerify(const Data& data)
+SecPolicySelfVerify::requireVerify(const Data& data)
{
return true;
}
ptr_lib::shared_ptr<ValidationRequest>
-SelfVerifyPolicyManager::checkVerificationPolicy
+SecPolicySelfVerify::checkVerificationPolicy
(const ptr_lib::shared_ptr<Data>& data, int stepCount, const OnVerified& onVerified, const OnVerifyFailed& onVerifyFailed)
{
// Cast to const Data* so that we use the const version of getSignature() and don't reset the default encoding.
const Sha256WithRsaSignature *signature = dynamic_cast<const Sha256WithRsaSignature*>(((const Data*)data.get())->getSignature());
if (!signature)
- throw SecurityException("SelfVerifyPolicyManager: Signature is not Sha256WithRsaSignature.");
+ throw SecurityException("SecPolicySelfVerify: Signature is not Sha256WithRsaSignature.");
if (signature->getKeyLocator().getType() == ndn_KeyLocatorType_KEY) {
// Use the public key DER directly.
@@ -116,13 +114,13 @@
}
bool
-SelfVerifyPolicyManager::checkSigningPolicy(const Name& dataName, const Name& certificateName)
+SecPolicySelfVerify::checkSigningPolicy(const Name& dataName, const Name& certificateName)
{
return true;
}
Name
-SelfVerifyPolicyManager::inferSigningIdentity(const Name& dataName)
+SecPolicySelfVerify::inferSigningIdentity(const Name& dataName)
{
return Name();
}
diff --git a/src/security/identity/sec-public-info-memory.cpp b/src/security/sec-public-info-memory.cpp
similarity index 97%
rename from src/security/identity/sec-public-info-memory.cpp
rename to src/security/sec-public-info-memory.cpp
index 966e574..61c6109 100644
--- a/src/security/identity/sec-public-info-memory.cpp
+++ b/src/security/sec-public-info-memory.cpp
@@ -5,10 +5,10 @@
* See COPYING for copyright and distribution information.
*/
-#include <ndn-cpp/security/identity/sec-public-info-memory.hpp>
+#include <ndn-cpp/security/sec-public-info-memory.hpp>
#include <algorithm>
-#include <ndn-cpp/security/certificate/identity-certificate.hpp>
+#include <ndn-cpp/security/identity-certificate.hpp>
using namespace std;
diff --git a/src/security/identity/sec-public-info-sqlite3.cpp b/src/security/sec-public-info-sqlite3.cpp
similarity index 98%
rename from src/security/identity/sec-public-info-sqlite3.cpp
rename to src/security/sec-public-info-sqlite3.cpp
index 8f80db9..37e872e 100644
--- a/src/security/identity/sec-public-info-sqlite3.cpp
+++ b/src/security/sec-public-info-sqlite3.cpp
@@ -14,12 +14,12 @@
#include <stdlib.h>
#include <sstream>
#include <fstream>
-#include "../../util/logging.hpp"
-#include "../../c/util/time.h"
+#include "../util/logging.hpp"
+#include "../c/util/time.h"
#include <ndn-cpp/data.hpp>
-#include <ndn-cpp/security/certificate/identity-certificate.hpp>
-#include <ndn-cpp/security/identity/sec-public-info-sqlite3.hpp>
-#include <ndn-cpp/security/signature/signature-sha256-with-rsa.hpp>
+#include <ndn-cpp/security/identity-certificate.hpp>
+#include <ndn-cpp/security/sec-public-info-sqlite3.hpp>
+#include <ndn-cpp/security/signature-sha256-with-rsa.hpp>
INIT_LOGGER("BasicKeyMetaInfo");
diff --git a/src/security/identity/sec-tpm-memory.cpp b/src/security/sec-tpm-memory.cpp
similarity index 97%
rename from src/security/identity/sec-tpm-memory.cpp
rename to src/security/sec-tpm-memory.cpp
index 9561cb9..fd6a79c 100644
--- a/src/security/identity/sec-tpm-memory.cpp
+++ b/src/security/sec-tpm-memory.cpp
@@ -5,8 +5,8 @@
* See COPYING for copyright and distribution information.
*/
-#include <ndn-cpp/security/identity/sec-tpm-memory.hpp>
-#include <ndn-cpp/security/certificate/public-key.hpp>
+#include <ndn-cpp/security/sec-tpm-memory.hpp>
+#include <ndn-cpp/security/public-key.hpp>
#include <openssl/ssl.h>
#include <openssl/sha.h>
#include <openssl/rsa.h>
diff --git a/src/security/identity/sec-tpm-osx.cpp b/src/security/sec-tpm-osx.cpp
similarity index 99%
rename from src/security/identity/sec-tpm-osx.cpp
rename to src/security/sec-tpm-osx.cpp
index f9954de..cfe7579 100644
--- a/src/security/identity/sec-tpm-osx.cpp
+++ b/src/security/sec-tpm-osx.cpp
@@ -10,10 +10,10 @@
#include <fstream>
#include <sstream>
-#include "../../util/logging.hpp"
+#include "../util/logging.hpp"
-#include <ndn-cpp/security/identity/sec-tpm-osx.hpp>
-#include <ndn-cpp/security/certificate/public-key.hpp>
+#include <ndn-cpp/security/sec-tpm-osx.hpp>
+#include <ndn-cpp/security/public-key.hpp>
#include <CoreFoundation/CoreFoundation.h>
#include <Security/Security.h>
diff --git a/src/security/verifier.cpp b/src/security/verifier.cpp
index a2ba790..992d1f0 100644
--- a/src/security/verifier.cpp
+++ b/src/security/verifier.cpp
@@ -20,7 +20,7 @@
#include <ndn-cpp/security/verifier.hpp>
-#include <ndn-cpp/security/policy/policy-manager.hpp>
+#include <ndn-cpp/security/sec-policy.hpp>
#include <cryptopp/rsa.h>
@@ -36,12 +36,12 @@
INIT_LOGGER("ndn.Verifier");
namespace ndn {
-const ptr_lib::shared_ptr<PolicyManager> Verifier::DefaultPolicyManager = ptr_lib::shared_ptr<PolicyManager>();
+const ptr_lib::shared_ptr<SecPolicy> Verifier::DefaultPolicy = ptr_lib::shared_ptr<SecPolicy>();
-Verifier::Verifier(const ptr_lib::shared_ptr<PolicyManager> &policyManager /* = DefaultPolicyManager */)
- : policyManager_(policyManager)
+Verifier::Verifier(const ptr_lib::shared_ptr<SecPolicy> &policy /* = DefaultPolicy */)
+ : policy_(policy)
{
- if (policyManager_ == DefaultPolicyManager)
+ if (policy_ == DefaultPolicy)
{
// #ifdef USE_SIMPLE_POLICY_MANAGER
// Ptr<SimplePolicyManager> policyManager = Ptr<SimplePolicyManager>(new SimplePolicyManager());
@@ -63,7 +63,7 @@
// m_policyManager = policyManager;
//
// #else
- // policyManager_ = new NoVerifyPolicyManager();
+ // policy_ = new NoVerifyPolicyManager();
// #endif
}
}
@@ -73,7 +73,7 @@
(const ptr_lib::shared_ptr<Data>& data, const OnVerified& onVerified, const OnVerifyFailed& onVerifyFailed, int stepCount)
{
if (policies().requireVerify(*data)) {
- ptr_lib::shared_ptr<ValidationRequest> nextStep = policyManager_->checkVerificationPolicy
+ ptr_lib::shared_ptr<ValidationRequest> nextStep = policy_->checkVerificationPolicy
(data, stepCount, onVerified, onVerifyFailed);
if (static_cast<bool>(nextStep))
{