security: renaming PolicyManager classess to SecPolicy___ and re-organize security file layout
Change-Id: Ibca0333129a3d4465ff294c4d97d59808ae253f4
diff --git a/include/ndn-cpp/security/signature-sha256-with-rsa.hpp b/include/ndn-cpp/security/signature-sha256-with-rsa.hpp
new file mode 100644
index 0000000..8eb26b1
--- /dev/null
+++ b/include/ndn-cpp/security/signature-sha256-with-rsa.hpp
@@ -0,0 +1,63 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * @author: Jeff Thompson <jefft0@remap.ucla.edu>
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NDN_SIGNATURE_SHA256_WITH_RSA_HPP
+#define NDN_SIGNATURE_SHA256_WITH_RSA_HPP
+
+#include "../data.hpp"
+
+namespace ndn {
+
+/**
+ * Representing of SHA256-with-RSA signature in a data packet.
+ */
+class SignatureSha256WithRsa : public Signature {
+public:
+ SignatureSha256WithRsa()
+ {
+ info_ = Block(Tlv::SignatureInfo);
+
+ type_ = Signature::Sha256WithRsa;
+ info_.push_back(nonNegativeIntegerBlock(Tlv::SignatureType, Tlv::SignatureSha256WithRsa));
+ }
+
+ SignatureSha256WithRsa(const Signature &signature)
+ : Signature(signature)
+ {
+ if (getType() != Signature::Sha256WithRsa)
+ throw Signature::Error("Incorrect signature type");
+
+ info_.parse();
+ Block::element_iterator i = info_.find(Tlv::KeyLocator);
+ if (i != info_.getAll().end())
+ {
+ keyLocator_.wireDecode(*i);
+ }
+ }
+
+ const KeyLocator&
+ getKeyLocator() const
+ {
+ return keyLocator_;
+ }
+
+ void
+ setKeyLocator(const KeyLocator& keyLocator)
+ {
+ keyLocator_ = keyLocator;
+
+ /// @todo Ensure that keylocator does not exist
+ info_.push_back(keyLocator_.wireEncode());
+ }
+
+private:
+ KeyLocator keyLocator_;
+};
+
+} // namespace ndn
+
+#endif