NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: 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_CERTIFICATE_EXTENSION_HPP
27 #define NDN_SECURITY_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 }
36 
37 namespace ndn {
38 
43 {
44 public:
45  class Error : public std::runtime_error
46  {
47  public:
48  explicit
49  Error(const std::string& what)
50  : std::runtime_error(what)
51  {
52  }
53  };
54 
55  explicit
56  CertificateExtension(CryptoPP::BufferedTransformation& in)
57  {
58  decode(in);
59  }
60 
67  CertificateExtension(const OID& oid, const bool isCritical, const Buffer& value)
68  : m_extensionId(oid), m_isCritical(isCritical), m_extensionValue(value)
69  {
70  }
71 
72  CertificateExtension(const OID& oid, const bool isCritical,
73  const uint8_t* value, size_t valueSize)
74  : m_extensionId(oid), m_isCritical(isCritical), m_extensionValue(value, valueSize)
75  {
76  }
77 
81  virtual
83  {
84  }
85 
86  void
87  encode(CryptoPP::BufferedTransformation& out) const;
88 
89  void
90  decode(CryptoPP::BufferedTransformation& in);
91 
92  inline const OID&
93  getOid() const
94  {
95  return m_extensionId;
96  }
97 
98  inline bool
99  getIsCritical() const
100  {
101  return m_isCritical;
102  }
103 
104  inline const Buffer&
105  getValue() const
106  {
107  return m_extensionValue;
108  }
109 
110 protected:
114 };
115 
116 } // namespace ndn
117 
118 #endif //NDN_SECURITY_CERTIFICATE_EXTENSION_HPP
Copyright (c) 2011-2015 Regents of the University of California.
Copyright (c) 2013-2014 Regents of the University of California.
Definition: oid.hpp:29
void decode(CryptoPP::BufferedTransformation &in)
STL namespace.
CertificateExtension(CryptoPP::BufferedTransformation &in)
const Buffer & getValue() const
CertificateExtension(const OID &oid, const bool isCritical, const Buffer &value)
Create a new CertificateExtension.
void encode(CryptoPP::BufferedTransformation &out) const
CertificateExtension(const OID &oid, const bool isCritical, const uint8_t *value, size_t valueSize)
Definition: oid.hpp:35
virtual ~CertificateExtension()
The virtual destructor.
A CertificateExtension represents the Extension entry in a certificate.
Class representing a general-use automatically managed/resized buffer.
Definition: buffer.hpp:44