secured-bag.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_SECURITY_V1_SECURED_BAG_HPP
23 #define NDN_SECURITY_V1_SECURED_BAG_HPP
24 
25 #include "../../common.hpp"
26 #include "identity-certificate.hpp"
27 
28 namespace ndn {
29 namespace security {
30 namespace v1 {
31 
33 {
34 public:
35  class Error : public tlv::Error
36  {
37  public:
38  explicit
39  Error(const std::string& what)
40  : tlv::Error(what)
41  {
42  }
43  };
44 
45  SecuredBag();
46 
47  explicit
48  SecuredBag(const Block& wire);
49 
50  SecuredBag(const IdentityCertificate& cert,
51  ConstBufferPtr key);
52 
53  virtual
54  ~SecuredBag();
55 
56  void
57  wireDecode(const Block& wire);
58 
59  const Block&
60  wireEncode() const;
61 
62  const IdentityCertificate&
64  {
65  return m_cert;
66  }
67 
69  getKey() const
70  {
71  return m_key;
72  }
73 
74 private:
75  IdentityCertificate m_cert;
76  ConstBufferPtr m_key;
77 
78  mutable Block m_wire;
79 };
80 
81 } // namespace v1
82 } // namespace security
83 } // namespace ndn
84 
85 #endif // NDN_SECURITY_V1_SECURED_BAG_HPP
Copyright (c) 2013-2017 Regents of the University of California.
Definition: common.hpp:75
Represents a TLV element of NDN packet format.
Definition: block.hpp:42
ConstBufferPtr getKey() const
Definition: secured-bag.hpp:69
void wireDecode(const Block &wire)
Definition: secured-bag.cpp:62
const IdentityCertificate & getCertificate() const
Definition: secured-bag.hpp:63
Error(const std::string &what)
Definition: secured-bag.hpp:39
const Block & wireEncode() const
Definition: secured-bag.cpp:75
shared_ptr< const Buffer > ConstBufferPtr
Definition: buffer.hpp:33
represents an error in TLV encoding or decoding