NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
certificate-extension.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NDN_SECURITY_V1_CERTIFICATE_EXTENSION_HPP
27 #define NDN_SECURITY_V1_CERTIFICATE_EXTENSION_HPP
28 
29 #include "../../common.hpp"
30 #include "../../encoding/buffer.hpp"
31 #include "../../encoding/oid.hpp"
32 
33 namespace CryptoPP {
34 class BufferedTransformation;
35 } // namespace CryptoPP
36 
37 namespace ndn {
38 namespace security {
39 namespace v1 {
40 
45 {
46 public:
47  class Error : public std::runtime_error
48  {
49  public:
50  explicit
51  Error(const std::string& what)
52  : std::runtime_error(what)
53  {
54  }
55  };
56 
57  explicit
58  CertificateExtension(CryptoPP::BufferedTransformation& in)
59  {
60  decode(in);
61  }
62 
69  CertificateExtension(const Oid& oid, const bool isCritical, const Buffer& value)
70  : m_extensionId(oid), m_isCritical(isCritical), m_extensionValue(value)
71  {
72  }
73 
74  CertificateExtension(const Oid& oid, const bool isCritical,
75  const uint8_t* value, size_t valueSize)
76  : m_extensionId(oid), m_isCritical(isCritical), m_extensionValue(value, valueSize)
77  {
78  }
79 
83  virtual
85  {
86  }
87 
88  void
89  encode(CryptoPP::BufferedTransformation& out) const;
90 
91  void
92  decode(CryptoPP::BufferedTransformation& in);
93 
94  inline const Oid&
95  getOid() const
96  {
97  return m_extensionId;
98  }
99 
100  inline bool
102  {
103  return m_isCritical;
104  }
105 
106  inline const Buffer&
107  getValue() const
108  {
109  return m_extensionValue;
110  }
111 
112 protected:
116 };
117 
118 } // namespace v1
119 } // namespace security
120 
121 #ifdef NDN_CXX_KEEP_SECURITY_V1_ALIASES
124 #endif // NDN_CXX_KEEP_SECURITY_V1_ALIASES
125 
126 } // namespace ndn
127 
128 #endif // NDN_SECURITY_V1_CERTIFICATE_EXTENSION_HPP
Copyright (c) 2011-2015 Regents of the University of California.
Copyright (c) 2013-2016 Regents of the University of California.
Definition: oid.hpp:29
STL namespace.
CertificateExtension(const Oid &oid, const bool isCritical, const Buffer &value)
Create a new CertificateExtension.
CertificateExtension(const Oid &oid, const bool isCritical, const uint8_t *value, size_t valueSize)
Definition: oid.hpp:35
CertificateExtension(CryptoPP::BufferedTransformation &in)
A CertificateExtension represents the Extension entry in a certificate.
virtual ~CertificateExtension()
The virtual destructor.
Class representing a general-use automatically managed/resized buffer.
Definition: buffer.hpp:44