security: Add SignatureSha256WithEcdsa

Change-Id: Ib3aa460d409c6d780b722e154ef2a620c510b16b
Refs: #1660
diff --git a/src/security/signature-sha256-with-rsa.hpp b/src/security/signature-sha256-with-rsa.hpp
index 8acda6e..bd3fd32 100644
--- a/src/security/signature-sha256-with-rsa.hpp
+++ b/src/security/signature-sha256-with-rsa.hpp
@@ -22,67 +22,38 @@
 #ifndef NDN_SECURITY_SIGNATURE_SHA256_WITH_RSA_HPP
 #define NDN_SECURITY_SIGNATURE_SHA256_WITH_RSA_HPP
 
-#include "../data.hpp"
-#include "../encoding/tlv.hpp"
+#include "signature-with-public-key.hpp"
 
 namespace ndn {
 
 /**
- * Representing of SHA256-with-RSA signature in a data packet.
+ * Represent a SHA256-with-RSA signature.
  */
-class SignatureSha256WithRsa : public Signature
+class SignatureSha256WithRsa : public SignatureWithPublicKey
 {
 public:
-  class Error : public Signature::Error
+  class Error : public SignatureWithPublicKey::Error
   {
   public:
     explicit
     Error(const std::string& what)
-      : Signature::Error(what)
+      : SignatureWithPublicKey::Error(what)
     {
     }
   };
 
   SignatureSha256WithRsa()
+    : SignatureWithPublicKey(Tlv::SignatureSha256WithRsa)
   {
-    m_info = Block(Tlv::SignatureInfo);
-
-    m_type = Signature::Sha256WithRsa;
-    m_info.push_back(nonNegativeIntegerBlock(Tlv::SignatureType, Tlv::SignatureSha256WithRsa));
-    m_info.push_back(m_keyLocator.wireEncode());
   }
 
+  explicit
   SignatureSha256WithRsa(const Signature& signature)
-    : Signature(signature)
+    : SignatureWithPublicKey(signature)
   {
     if (getType() != Signature::Sha256WithRsa)
       throw Error("Incorrect signature type");
-
-    m_info.parse();
-    Block::element_const_iterator i = m_info.find(Tlv::KeyLocator);
-    if (i != m_info.elements_end())
-      {
-        m_keyLocator.wireDecode(*i);
-      }
   }
-
-  const KeyLocator&
-  getKeyLocator() const
-  {
-    return m_keyLocator;
-  }
-
-  void
-  setKeyLocator(const KeyLocator& keyLocator)
-  {
-    m_keyLocator = keyLocator;
-
-    m_info.remove(ndn::Tlv::KeyLocator);
-    m_info.push_back(m_keyLocator.wireEncode());
-  }
-
-private:
-  KeyLocator m_keyLocator;
 };
 
 } // namespace ndn