Move validation-request.hpp to public API. Moved static verifySha256WithRsaSignature to new Sha256WithRsaHandler::verify.
diff --git a/include/Makefile.am b/include/Makefile.am
index abe0340..b38a6d4 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -20,6 +20,7 @@
$(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/Makefile.in b/include/Makefile.in
index f131cba..d4f6cad 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -340,6 +340,7 @@
$(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/security/key-chain.hpp b/include/ndn-cpp/security/key-chain.hpp
index 6cc4695..4248850 100644
--- a/include/ndn-cpp/security/key-chain.hpp
+++ b/include/ndn-cpp/security/key-chain.hpp
@@ -1,6 +1,7 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/**
* Copyright (C) 2013 Regents of the University of California.
+ * @author: Yingdi Yu <yingdi@cs.ucla.edu>
* @author: Jeff Thompson <jefft0@remap.ucla.edu>
* See COPYING for copyright and distribution information.
*/
@@ -12,26 +13,16 @@
#include "../face.hpp"
#include "identity/identity-manager.hpp"
#include "encryption/encryption-manager.hpp"
+#include "policy/validation-request.hpp"
namespace ndn {
class PolicyManager;
-class ValidationRequest;
/**
- * An OnVerified function object is used to pass a callback to verifyData to report a successful verification.
- */
-typedef func_lib::function<void(const ptr_lib::shared_ptr<Data>& data)> OnVerified;
-
-/**
- * An OnVerifyFailed function object is used to pass a callback to verifyData to report a failed verification.
- */
-typedef func_lib::function<void(const ptr_lib::shared_ptr<Data>& data)> OnVerifyFailed;
-
-/**
- * Keychain is the main class of the security library.
+ * KeyChain is the main class of the security library.
*
- * The Keychain class provides a set of interfaces to the security library such as identity management, policy configuration
+ * The KeyChain class provides a set of interfaces to the security library such as identity management, policy configuration
* and packet signing and verification.
*/
class KeyChain {
diff --git a/include/ndn-cpp/security/policy/validation-request.hpp b/include/ndn-cpp/security/policy/validation-request.hpp
new file mode 100644
index 0000000..78f2d6c
--- /dev/null
+++ b/include/ndn-cpp/security/policy/validation-request.hpp
@@ -0,0 +1,48 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * @author: Yingdi Yu <yingdi@cs.ucla.edu>
+ * @author: Jeff Thompson <jefft0@remap.ucla.edu>
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NDN_VALIDATION_REQUEST_HPP
+#define NDN_VALIDATION_REQUEST_HPP
+
+#include "../key-chain.hpp"
+
+namespace ndn {
+
+/**
+ * An OnVerified function object is used to pass a callback to verifyData to report a successful verification.
+ */
+typedef func_lib::function<void(const ptr_lib::shared_ptr<Data>& data)> OnVerified;
+
+/**
+ * An OnVerifyFailed function object is used to pass a callback to verifyData to report a failed verification.
+ */
+typedef func_lib::function<void(const ptr_lib::shared_ptr<Data>& data)> OnVerifyFailed;
+
+
+class ValidationRequest {
+public:
+ ValidationRequest
+ (const ptr_lib::shared_ptr<Interest> &interest, const OnVerified& onVerified, const OnVerifyFailed& onVerifyFailed,
+ int retry, int stepCount)
+ : interest_(interest), onVerified_(onVerified), onVerifyFailed_(onVerifyFailed), retry_(retry), stepCount_(stepCount)
+ {
+ }
+
+ virtual
+ ~ValidationRequest() {}
+
+ ptr_lib::shared_ptr<Interest> interest_; // An interest packet to fetch the requested data.
+ OnVerified onVerified_; // A callback function if the requested certificate has been validated.
+ OnVerifyFailed onVerifyFailed_; // A callback function if the requested certificate cannot be validated.
+ int retry_; // The number of retrials when there is an interest timeout.
+ int stepCount_;
+};
+
+}
+
+#endif
diff --git a/include/ndn-cpp/security/signature/sha256-with-rsa-handler.hpp b/include/ndn-cpp/security/signature/sha256-with-rsa-handler.hpp
new file mode 100644
index 0000000..4cc9f98
--- /dev/null
+++ b/include/ndn-cpp/security/signature/sha256-with-rsa-handler.hpp
@@ -0,0 +1,38 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * @author: Yingdi Yu <yingdi@cs.ucla.edu>
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NDN_SHA256_RSA_HANDLER_HPP
+#define NDN_SHA256_RSA_HANDLER_HPP
+
+#include "../../data.hpp"
+#include "../certificate/public-key.hpp"
+
+namespace ndn{
+
+class Sha256WithRsaHandler {
+public:
+ Sha256WithRsaHandler() {}
+
+ virtual
+ ~Sha256WithRsaHandler() {}
+
+ /**
+ * Verify the signature on the data packet using the given public key. If there is no data.getDefaultWireEncoding(),
+ * this calls data.wireEncode() to set it.
+ * @param data The data packet with the signed portion and the signature to verify. The data packet must have a
+ * Sha256WithRsaSignature.
+ * @param publicKey The public key used to verify the signature.
+ * @return true if the signature verifies, false if not.
+ * @throw SecurityException if data does not have a Sha256WithRsaSignature.
+ */
+ static bool
+ verify(const Data& data, const PublicKey& publicKey);
+
+};
+
+}
+#endif