All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
signature-sha256-with-rsa.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
7 #ifndef NDN_SECURITY_SIGNATURE_SHA256_WITH_RSA_HPP
8 #define NDN_SECURITY_SIGNATURE_SHA256_WITH_RSA_HPP
9 
10 #include "../data.hpp"
11 #include "../encoding/tlv.hpp"
12 
13 namespace ndn {
14 
19 {
20 public:
21  class Error : public Signature::Error
22  {
23  public:
24  explicit
25  Error(const std::string& what)
26  : Signature::Error(what)
27  {
28  }
29  };
30 
32  {
34 
37  m_info.push_back(m_keyLocator.wireEncode());
38  }
39 
41  : Signature(signature)
42  {
44  throw Error("Incorrect signature type");
45 
46  m_info.parse();
48  if (i != m_info.elements_end())
49  {
50  m_keyLocator.wireDecode(*i);
51  }
52  }
53 
54  const KeyLocator&
55  getKeyLocator() const
56  {
57  return m_keyLocator;
58  }
59 
60  void
61  setKeyLocator(const KeyLocator& keyLocator)
62  {
63  m_keyLocator = keyLocator;
64 
66  m_info.push_back(m_keyLocator.wireEncode());
67  }
68 
69 private:
70  KeyLocator m_keyLocator;
71 };
72 
73 } // namespace ndn
74 
75 #endif //NDN_SECURITY_SIGNATURE_SHA256_WITH_RSA_HPP
Representing of SHA256-with-RSA signature in a data packet.
Block nonNegativeIntegerBlock(uint32_t type, uint64_t value)
int32_t m_type
Definition: signature.hpp:114
element_const_iterator find(uint32_t type) const
Definition: block.hpp:343
SignatureSha256WithRsa(const Signature &signature)
void wireDecode(const Block &wire)
Class representing wire element of the NDN packet.
Definition: block.hpp:26
element_const_iterator elements_end() const
Definition: block.hpp:476
uint32_t getType() const
Definition: signature.hpp:50
const KeyLocator & getKeyLocator() const
element_container::const_iterator element_const_iterator
Definition: block.hpp:31
void remove(uint32_t type)
Definition: block.hpp:358
void push_back(const Block &element)
Definition: block.hpp:390
void parse() const
Parse wire buffer into subblocks.
Definition: block.cpp:265
void setKeyLocator(const KeyLocator &keyLocator)
SignatureType
Definition: tlv.hpp:66
size_t wireEncode(EncodingImpl< T > &block) const
A Signature is storage for the signature-related information (info and value) in a Data packet...
Definition: signature.hpp:15