NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
safe-bag.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
23 #ifndef NDN_CXX_SECURITY_SAFE_BAG_HPP
24 #define NDN_CXX_SECURITY_SAFE_BAG_HPP
25 
26 #include "../common.hpp"
27 #include "../data.hpp"
28 #include "../encoding/buffer.hpp"
29 #include "../encoding/encoder.hpp"
30 #include "../encoding/encoding-buffer.hpp"
31 #include "security-common.hpp"
32 
33 namespace ndn {
34 namespace security {
35 
38 class SafeBag
39 {
40 public:
44  SafeBag();
45 
49  explicit
50  SafeBag(const Block& wire);
51 
58  SafeBag(const Data& certificate,
59  const Buffer& encryptedKeyBag);
60 
68  SafeBag(const Data& certificate,
69  const uint8_t* encryptedKey,
70  size_t encryptedKeyLen);
71 
72 public:
76  template<encoding::Tag TAG>
77  size_t
78  wireEncode(EncodingImpl<TAG>& encoder) const;
79 
83  const Block&
84  wireEncode() const;
85 
89  void
90  wireDecode(const Block& wire);
91 
92 public:
96  const Data&
98  {
99  return m_certificate;
100  }
101 
105  const Buffer&
107  {
108  return m_encryptedKeyBag;
109  }
110 
111 private:
112  Data m_certificate;
113  Buffer m_encryptedKeyBag;
114 
115  mutable Block m_wire;
116 };
117 
118 } // namespace security
119 } // namespace ndn
120 
121 #endif // NDN_CXX_SECURITY_SAFE_BAG_HPP
Copyright (c) 2011-2015 Regents of the University of California.
SafeBag()
Create a new empty SafeBag object.
Class representing a wire element of NDN-TLV packet format.
Definition: block.hpp:43
const Buffer & getEncryptedKeyBag() const
Get the private key in PKCS#8 from safe bag.
Definition: safe-bag.hpp:106
const Data & getCertificate() const
Get the certificate data packet from safe bag.
Definition: safe-bag.hpp:97
void wireDecode(const Block &wire)
Decode the input from wire format.
Definition: safe-bag.cpp:97
a secured container for sensitive information(certificate, private key)
Definition: safe-bag.hpp:38
const Block & wireEncode() const
Encode to a wire format.
Definition: safe-bag.cpp:84
represents a Data packet
Definition: data.hpp:37
Class representing a general-use automatically managed/resized buffer.
Definition: buffer.hpp:44