security: renaming PolicyManager classess to SecPolicy___ and re-organize security file layout
Change-Id: Ibca0333129a3d4465ff294c4d97d59808ae253f4
diff --git a/Makefile.am b/Makefile.am
index 94a9fbf..49df82f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -99,17 +99,17 @@
src/interest.cpp \
src/name.cpp \
src/node.cpp \
- src/security/certificate/certificate-extension.cpp \
- src/security/certificate/certificate-subject-description.cpp \
- src/security/certificate/certificate.cpp \
- src/security/certificate/identity-certificate.cpp \
- src/security/certificate/public-key.cpp \
- src/security/identity/sec-public-info-sqlite3.cpp \
- src/security/identity/sec-public-info-memory.cpp \
- src/security/identity/sec-tpm-memory.cpp \
+ src/security/certificate-extension.cpp \
+ src/security/certificate-subject-description.cpp \
+ src/security/certificate.cpp \
+ src/security/identity-certificate.cpp \
+ src/security/public-key.cpp \
+ src/security/sec-public-info-sqlite3.cpp \
+ src/security/sec-public-info-memory.cpp \
+ src/security/sec-tpm-memory.cpp \
src/security/verifier.cpp \
- src/security/policy/no-verify-policy-manager.cpp \
- src/security/policy/self-verify-policy-manager.cpp \
+ src/security/sec-policy-no-verify.cpp \
+ src/security/sec-policy-self-verify.cpp \
src/transport/unix-transport.cpp \
src/util/blob-stream.hpp \
src/util/blob.cpp \
@@ -124,9 +124,9 @@
src/util/time.hpp
if HAVE_OSX_SECURITY
- libndn_cpp_la_SOURCES += src/security/identity/sec-tpm-osx.cpp
+ libndn_cpp_la_SOURCES += src/security/sec-tpm-osx.cpp
else
- EXTRA_DIST = src/security/identity/sec-tpm-osx.cpp
+ EXTRA_DIST = src/security/sec-tpm-osx.cpp
endif
libndn_cpp_la_LIBADD = @OPENSSL_LIBS@ @CRYPTOPP_LIBS@ @OSX_SECURITY_LIBS@ @BOOST_SYSTEM_LIB@
diff --git a/include/Makefile.am b/include/Makefile.am
index d2729b4..cab21a1 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -17,11 +17,6 @@
$(wildcard ndn-cpp/*.hpp) \
$(wildcard ndn-cpp/encoding/*.*) \
$(wildcard ndn-cpp/security/*.*) \
- $(wildcard ndn-cpp/security/certificate/*.*) \
- $(wildcard ndn-cpp/security/encryption/*.*) \
- $(wildcard ndn-cpp/security/identity/*.*) \
- $(wildcard ndn-cpp/security/policy/*.*) \
- $(wildcard ndn-cpp/security/signature/*.*) \
$(wildcard ndn-cpp/transport/*.*) \
$(wildcard ndn-cpp/util/*.*)
diff --git a/include/ndn-cpp/data.hpp b/include/ndn-cpp/data.hpp
index 6f0f397..e2d9451 100644
--- a/include/ndn-cpp/data.hpp
+++ b/include/ndn-cpp/data.hpp
@@ -15,7 +15,6 @@
#include "signature.hpp"
#include "meta-info.hpp"
#include "key-locator.hpp"
-#include "security/signature/signature-sha256-with-rsa.hpp"
namespace ndn {
diff --git a/include/ndn-cpp/security/certificate/certificate-extension.hpp b/include/ndn-cpp/security/certificate-extension.hpp
similarity index 94%
rename from include/ndn-cpp/security/certificate/certificate-extension.hpp
rename to include/ndn-cpp/security/certificate-extension.hpp
index c212216..61f7dd2 100644
--- a/include/ndn-cpp/security/certificate/certificate-extension.hpp
+++ b/include/ndn-cpp/security/certificate-extension.hpp
@@ -9,9 +9,9 @@
#ifndef NDN_CERTIFICATE_EXTENSION_HPP
#define NDN_CERTIFICATE_EXTENSION_HPP
-#include "../../common.hpp"
-#include "../../encoding/buffer.hpp"
-#include "../../encoding/oid.hpp"
+#include "../common.hpp"
+#include "../encoding/buffer.hpp"
+#include "../encoding/oid.hpp"
namespace CryptoPP { class BufferedTransformation; }
diff --git a/include/ndn-cpp/security/certificate/certificate-subject-description.hpp b/include/ndn-cpp/security/certificate-subject-description.hpp
similarity index 95%
rename from include/ndn-cpp/security/certificate/certificate-subject-description.hpp
rename to include/ndn-cpp/security/certificate-subject-description.hpp
index 5717920..fc26d37 100644
--- a/include/ndn-cpp/security/certificate/certificate-subject-description.hpp
+++ b/include/ndn-cpp/security/certificate-subject-description.hpp
@@ -9,8 +9,8 @@
#ifndef NDN_CERTIFICATE_SUBJECT_DESCRIPTION_HPP
#define NDN_CERTIFICATE_SUBJECT_DESCRIPTION_HPP
-#include "../../common.hpp"
-#include "../../encoding/oid.hpp"
+#include "../common.hpp"
+#include "../encoding/oid.hpp"
namespace CryptoPP { class BufferedTransformation; }
diff --git a/include/ndn-cpp/security/certificate/certificate.hpp b/include/ndn-cpp/security/certificate.hpp
similarity index 98%
rename from include/ndn-cpp/security/certificate/certificate.hpp
rename to include/ndn-cpp/security/certificate.hpp
index c2fd95a..9871733 100644
--- a/include/ndn-cpp/security/certificate/certificate.hpp
+++ b/include/ndn-cpp/security/certificate.hpp
@@ -9,8 +9,8 @@
#ifndef NDN_CERTIFICATE_HPP
#define NDN_CERTIFICATE_HPP
-#include "../../data.hpp"
-#include "../../common.hpp"
+#include "../data.hpp"
+#include "../common.hpp"
#include "certificate-subject-description.hpp"
#include "certificate-extension.hpp"
diff --git a/include/ndn-cpp/security/encryption/encryption-manager.hpp b/include/ndn-cpp/security/encryption-manager.hpp
similarity index 100%
rename from include/ndn-cpp/security/encryption/encryption-manager.hpp
rename to include/ndn-cpp/security/encryption-manager.hpp
diff --git a/include/ndn-cpp/security/certificate/identity-certificate.hpp b/include/ndn-cpp/security/identity-certificate.hpp
similarity index 100%
rename from include/ndn-cpp/security/certificate/identity-certificate.hpp
rename to include/ndn-cpp/security/identity-certificate.hpp
diff --git a/include/ndn-cpp/security/key-chain.hpp b/include/ndn-cpp/security/key-chain.hpp
index 9eb0b13..8e1e81c 100644
--- a/include/ndn-cpp/security/key-chain.hpp
+++ b/include/ndn-cpp/security/key-chain.hpp
@@ -9,14 +9,14 @@
#ifndef NDN_KEY_CHAIN_HPP
#define NDN_KEY_CHAIN_HPP
-#include "certificate/identity-certificate.hpp"
-#include "certificate/public-key.hpp"
-#include "signature/signature-sha256-with-rsa.hpp"
+#include "identity-certificate.hpp"
+#include "public-key.hpp"
+#include "signature-sha256-with-rsa.hpp"
-#include "identity/sec-public-info-sqlite3.hpp"
-#include "identity/sec-public-info-memory.hpp"
-#include "identity/sec-tpm-osx.hpp"
-#include "identity/sec-tpm-memory.hpp"
+#include "sec-public-info-sqlite3.hpp"
+#include "sec-public-info-memory.hpp"
+#include "sec-tpm-osx.hpp"
+#include "sec-tpm-memory.hpp"
namespace ndn {
diff --git a/include/ndn-cpp/security/certificate/public-key.hpp b/include/ndn-cpp/security/public-key.hpp
similarity index 94%
rename from include/ndn-cpp/security/certificate/public-key.hpp
rename to include/ndn-cpp/security/public-key.hpp
index ed0687a..5a70e38 100644
--- a/include/ndn-cpp/security/certificate/public-key.hpp
+++ b/include/ndn-cpp/security/public-key.hpp
@@ -10,9 +10,9 @@
#define NDN_PUBLIC_KEY_HPP
#include <stdexcept>
-#include "../../encoding/oid.hpp"
-#include "../../encoding/buffer.hpp"
-#include "../security-common.hpp"
+#include "../encoding/oid.hpp"
+#include "../encoding/buffer.hpp"
+#include "security-common.hpp"
namespace ndn {
diff --git a/include/ndn-cpp/security/policy/no-verify-policy-manager.hpp b/include/ndn-cpp/security/sec-policy-no-verify.hpp
similarity index 90%
rename from include/ndn-cpp/security/policy/no-verify-policy-manager.hpp
rename to include/ndn-cpp/security/sec-policy-no-verify.hpp
index 1ee9f75..1d2927e 100644
--- a/include/ndn-cpp/security/policy/no-verify-policy-manager.hpp
+++ b/include/ndn-cpp/security/sec-policy-no-verify.hpp
@@ -6,20 +6,20 @@
* See COPYING for copyright and distribution information.
*/
-#ifndef NDN_NO_VERIFY_POLICY_MANAGER_HPP
-#define NDN_NO_VERIFY_POLICY_MANAGER_HPP
+#ifndef NDN_SEC_POLICY_NO_VERIFY_HPP
+#define NDN_SEC_POLICY_NO_VERIFY_HPP
-#include "policy-manager.hpp"
+#include "sec-policy.hpp"
namespace ndn {
-class NoVerifyPolicyManager : public PolicyManager {
+class SecPolicyNoVerify : public SecPolicy {
public:
/**
* The virtual destructor.
*/
virtual
- ~NoVerifyPolicyManager();
+ ~SecPolicyNoVerify();
/**
* Override to always skip verification and trust as valid.
diff --git a/include/ndn-cpp/security/policy/self-verify-policy-manager.hpp b/include/ndn-cpp/security/sec-policy-self-verify.hpp
similarity index 79%
rename from include/ndn-cpp/security/policy/self-verify-policy-manager.hpp
rename to include/ndn-cpp/security/sec-policy-self-verify.hpp
index 14da3c1..111b61a 100644
--- a/include/ndn-cpp/security/policy/self-verify-policy-manager.hpp
+++ b/include/ndn-cpp/security/sec-policy-self-verify.hpp
@@ -5,31 +5,28 @@
* See COPYING for copyright and distribution information.
*/
-#ifndef NDN_SELF_VERIFY_POLICY_MANAGER_HPP
-#define NDN_SELF_VERIFY_POLICY_MANAGER_HPP
+#ifndef NDN_SEC_POLICY_SELF_VERIFY_HPP
+#define NDN_SEC_POLICY_SELF_VERIFY_HPP
-#include "policy-manager.hpp"
+#include "sec-policy.hpp"
namespace ndn {
-class IdentityManager;
-
/**
- * A SelfVerifyPolicyManager implements a PolicyManager to use the public key DER in the data packet's KeyLocator (if available)
+ * A SecPolicySelfVerify implements a PolicyManager to use the public key DER in the data packet's KeyLocator (if available)
* or look in the IdentityStorage for the public key with the name in the KeyLocator (if available) and use
* it to verify the data packet, without searching a certificate chain. If the public key can't be found, the
* verification fails.
*/
-class SelfVerifyPolicyManager : public PolicyManager {
+class SecPolicySelfVerify : public SecPolicy {
public:
/**
- * Create a new SelfVerifyPolicyManager which will look up the public key in the given identityManager.
+ * Create a new SecPolicySelfVerify which will look up the public key in the given identityManager.
* @param identityManager (optional) The IdentityManager for looking up the public key. This points to an object must which remain
- * valid during the life of this SelfVerifyPolicyManager. If omitted, then don't look for a public key with the name
+ * valid during the life of this SecPolicySelfVerify. If omitted, then don't look for a public key with the name
* in the KeyLocator and rely on the KeyLocator having the full public key DER.
*/
- SelfVerifyPolicyManager(IdentityStorage* identityStorage = 0)
- : identityStorage_(identityStorage)
+ SecPolicySelfVerify()
{
}
@@ -37,7 +34,7 @@
* The virtual destructor.
*/
virtual
- ~SelfVerifyPolicyManager();
+ ~SecPolicySelfVerify();
/**
* Never skip verification.
@@ -87,8 +84,6 @@
virtual Name
inferSigningIdentity(const Name& dataName);
-private:
- IdentityStorage* identityStorage_;
};
}
diff --git a/include/ndn-cpp/security/policy/policy-manager.hpp b/include/ndn-cpp/security/sec-policy.hpp
similarity index 87%
rename from include/ndn-cpp/security/policy/policy-manager.hpp
rename to include/ndn-cpp/security/sec-policy.hpp
index 400360d..e3879bb 100644
--- a/include/ndn-cpp/security/policy/policy-manager.hpp
+++ b/include/ndn-cpp/security/sec-policy.hpp
@@ -6,21 +6,19 @@
* See COPYING for copyright and distribution information.
*/
-#ifndef NDN_POLICY_MANAGER_HPP
-#define NDN_POLICY_MANAGER_HPP
+#ifndef NDN_SEC_POLICY_HPP
+#define NDN_SEC_POLICY_HPP
-#include "../../data.hpp"
+#include "../data.hpp"
#include "validation-request.hpp"
namespace ndn {
-
-class ValidationRequest;
/**
- * A PolicyManager is an abstract base class to represent the policy for verifying data packets.
+ * A SecPolicy is an abstract base class to represent the policy for verifying data packets.
* You must create an object of a subclass.
*/
-class PolicyManager {
+class SecPolicy {
public:
struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} };
@@ -28,7 +26,7 @@
* The virtual destructor.
*/
virtual
- ~PolicyManager() {}
+ ~SecPolicy() {}
/**
* Check if the received data packet can escape from verification and be trusted as valid.
@@ -39,7 +37,7 @@
skipVerifyAndTrust(const Data& data) = 0;
/**
- * Check if this PolicyManager has a verification rule for the received data.
+ * Check if this SecPolicy has a verification rule for the received data.
* @param data The received data packet.
* @return true if the data must be verified, otherwise false.
*/
diff --git a/include/ndn-cpp/security/identity/sec-public-info-memory.hpp b/include/ndn-cpp/security/sec-public-info-memory.hpp
similarity index 100%
rename from include/ndn-cpp/security/identity/sec-public-info-memory.hpp
rename to include/ndn-cpp/security/sec-public-info-memory.hpp
diff --git a/include/ndn-cpp/security/identity/sec-public-info-sqlite3.hpp b/include/ndn-cpp/security/sec-public-info-sqlite3.hpp
similarity index 99%
rename from include/ndn-cpp/security/identity/sec-public-info-sqlite3.hpp
rename to include/ndn-cpp/security/sec-public-info-sqlite3.hpp
index 99dac54..89ffe6e 100644
--- a/include/ndn-cpp/security/identity/sec-public-info-sqlite3.hpp
+++ b/include/ndn-cpp/security/sec-public-info-sqlite3.hpp
@@ -14,7 +14,7 @@
#ifdef NDN_CPP_HAVE_SQLITE3
#include <sqlite3.h>
-#include "../../common.hpp"
+#include "../common.hpp"
#include "sec-public-info.hpp"
namespace ndn
diff --git a/include/ndn-cpp/security/identity/sec-public-info.hpp b/include/ndn-cpp/security/sec-public-info.hpp
similarity index 98%
rename from include/ndn-cpp/security/identity/sec-public-info.hpp
rename to include/ndn-cpp/security/sec-public-info.hpp
index 961cf95..7cd7230 100644
--- a/include/ndn-cpp/security/identity/sec-public-info.hpp
+++ b/include/ndn-cpp/security/sec-public-info.hpp
@@ -9,10 +9,10 @@
#ifndef NDN_SEC_PUBLIC_INFO_HPP
#define NDN_SEC_PUBLIC_INFO_HPP
-#include "../../name.hpp"
-#include "../security-common.hpp"
-#include "../certificate/public-key.hpp"
-#include "../certificate/identity-certificate.hpp"
+#include "../name.hpp"
+#include "security-common.hpp"
+#include "public-key.hpp"
+#include "identity-certificate.hpp"
namespace ndn {
diff --git a/include/ndn-cpp/security/identity/sec-tpm-memory.hpp b/include/ndn-cpp/security/sec-tpm-memory.hpp
similarity index 100%
rename from include/ndn-cpp/security/identity/sec-tpm-memory.hpp
rename to include/ndn-cpp/security/sec-tpm-memory.hpp
diff --git a/include/ndn-cpp/security/identity/sec-tpm-osx.hpp b/include/ndn-cpp/security/sec-tpm-osx.hpp
similarity index 98%
rename from include/ndn-cpp/security/identity/sec-tpm-osx.hpp
rename to include/ndn-cpp/security/sec-tpm-osx.hpp
index 0b90fd0..71efa13 100644
--- a/include/ndn-cpp/security/identity/sec-tpm-osx.hpp
+++ b/include/ndn-cpp/security/sec-tpm-osx.hpp
@@ -12,7 +12,7 @@
#include <ndn-cpp/ndn-cpp-config.h>
#if NDN_CPP_HAVE_OSX_SECURITY
-#include "../../common.hpp"
+#include "../common.hpp"
#include "sec-tpm.hpp"
namespace ndn
diff --git a/include/ndn-cpp/security/identity/sec-tpm.hpp b/include/ndn-cpp/security/sec-tpm.hpp
similarity index 95%
rename from include/ndn-cpp/security/identity/sec-tpm.hpp
rename to include/ndn-cpp/security/sec-tpm.hpp
index 9452f9f..d7a8e04 100644
--- a/include/ndn-cpp/security/identity/sec-tpm.hpp
+++ b/include/ndn-cpp/security/sec-tpm.hpp
@@ -10,10 +10,10 @@
#define NDN_SEC_TPM_HPP
#include <string>
-#include "../security-common.hpp"
-#include "../../name.hpp"
-#include "../../data.hpp"
-#include "../certificate/public-key.hpp"
+#include "security-common.hpp"
+#include "../name.hpp"
+#include "../data.hpp"
+#include "public-key.hpp"
namespace ndn {
diff --git a/include/ndn-cpp/security/signature/sha256-with-rsa-handler.hpp b/include/ndn-cpp/security/sha256-with-rsa-handler.hpp
similarity index 100%
rename from include/ndn-cpp/security/signature/sha256-with-rsa-handler.hpp
rename to include/ndn-cpp/security/sha256-with-rsa-handler.hpp
diff --git a/include/ndn-cpp/security/signature/signature-sha256-with-rsa.hpp b/include/ndn-cpp/security/signature-sha256-with-rsa.hpp
similarity index 97%
rename from include/ndn-cpp/security/signature/signature-sha256-with-rsa.hpp
rename to include/ndn-cpp/security/signature-sha256-with-rsa.hpp
index a24e94b..8eb26b1 100644
--- a/include/ndn-cpp/security/signature/signature-sha256-with-rsa.hpp
+++ b/include/ndn-cpp/security/signature-sha256-with-rsa.hpp
@@ -8,7 +8,7 @@
#ifndef NDN_SIGNATURE_SHA256_WITH_RSA_HPP
#define NDN_SIGNATURE_SHA256_WITH_RSA_HPP
-#include "../../data.hpp"
+#include "../data.hpp"
namespace ndn {
diff --git a/include/ndn-cpp/security/policy/validation-request.hpp b/include/ndn-cpp/security/validation-request.hpp
similarity index 97%
rename from include/ndn-cpp/security/policy/validation-request.hpp
rename to include/ndn-cpp/security/validation-request.hpp
index 69a1079..7471065 100644
--- a/include/ndn-cpp/security/policy/validation-request.hpp
+++ b/include/ndn-cpp/security/validation-request.hpp
@@ -9,7 +9,7 @@
#ifndef NDN_VALIDATION_REQUEST_HPP
#define NDN_VALIDATION_REQUEST_HPP
-#include "../../interest.hpp"
+#include "../interest.hpp"
namespace ndn {
diff --git a/include/ndn-cpp/security/verifier.hpp b/include/ndn-cpp/security/verifier.hpp
index 537e74d..764dcd4 100644
--- a/include/ndn-cpp/security/verifier.hpp
+++ b/include/ndn-cpp/security/verifier.hpp
@@ -11,13 +11,12 @@
#include "../data.hpp"
#include "../face.hpp"
-#include "policy/validation-request.hpp"
-#include "certificate/public-key.hpp"
-#include "signature/signature-sha256-with-rsa.hpp"
+#include "sec-policy.hpp"
+#include "validation-request.hpp"
+#include "public-key.hpp"
+#include "signature-sha256-with-rsa.hpp"
namespace ndn {
-
-class PolicyManager;
/**
* Verifier is one of the main classes of the security librar .
@@ -28,7 +27,7 @@
public:
struct Error : public std::runtime_error { Error(const std::string &what) : std::runtime_error(what) {} };
- Verifier(const ptr_lib::shared_ptr<PolicyManager> &policyManager = DefaultPolicyManager);
+ Verifier(const ptr_lib::shared_ptr<SecPolicy> &policy = DefaultPolicy);
/**
* @brief Set the Face which will be used to fetch required certificates.
@@ -40,16 +39,16 @@
setFace(const ptr_lib::shared_ptr<Face> &face) { face_ = face; }
/**
- * @brief Get the policyManager.
- * @return The PolicyManager.
+ * @brief Get the policy.
+ * @return The Policy.
*/
- inline PolicyManager&
+ inline SecPolicy&
policies()
{
- if (!policyManager_)
- throw Error("PolicyManager is not assigned to the KeyChain");
+ if (!policy_)
+ throw Error("policy is not assigned to the KeyChain");
- return *policyManager_;
+ return *policy_;
}
@@ -81,7 +80,7 @@
verifySignature(const Buffer &data, const SignatureSha256WithRsa &sig, const PublicKey &publicKey);
public:
- static const ptr_lib::shared_ptr<PolicyManager> DefaultPolicyManager;
+ static const ptr_lib::shared_ptr<SecPolicy> DefaultPolicy;
private:
void
@@ -94,7 +93,7 @@
const ptr_lib::shared_ptr<Data> &data, ptr_lib::shared_ptr<ValidationRequest> nextStep);
private:
- ptr_lib::shared_ptr<PolicyManager> policyManager_;
+ ptr_lib::shared_ptr<SecPolicy> policy_;
ptr_lib::shared_ptr<Face> face_;
};
diff --git a/src/node.cpp b/src/node.cpp
index 404853e..6641bbc 100644
--- a/src/node.cpp
+++ b/src/node.cpp
@@ -14,7 +14,7 @@
#include "util/ndnd-id-fetcher.hpp"
-#include <ndn-cpp/security/signature/signature-sha256-with-rsa.hpp>
+#include <ndn-cpp/security/signature-sha256-with-rsa.hpp>
#include <ndn-cpp/status-response.hpp>
using namespace std;
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))
{
diff --git a/tests_boost/test-encode-decode-certificate.cpp b/tests_boost/test-encode-decode-certificate.cpp
index 9acc569..4799ce9 100644
--- a/tests_boost/test-encode-decode-certificate.cpp
+++ b/tests_boost/test-encode-decode-certificate.cpp
@@ -6,8 +6,8 @@
#include <boost/test/unit_test.hpp>
-#include <ndn-cpp/security/certificate/certificate.hpp>
-#include <ndn-cpp/security/certificate/public-key.hpp>
+#include <ndn-cpp/security/certificate.hpp>
+#include <ndn-cpp/security/public-key.hpp>
#if __clang__
#pragma clang diagnostic push