All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
certificate-extension.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
9 #ifndef NDN_SECURITY_CERTIFICATE_EXTENSION_HPP
10 #define NDN_SECURITY_CERTIFICATE_EXTENSION_HPP
11 
12 #include "../common.hpp"
13 #include "../encoding/buffer.hpp"
14 #include "../encoding/oid.hpp"
15 
16 namespace CryptoPP {
17 class BufferedTransformation;
18 }
19 
20 namespace ndn {
21 
26 {
27 public:
28  class Error : public std::runtime_error
29  {
30  public:
31  explicit
32  Error(const std::string& what)
33  : std::runtime_error(what)
34  {
35  }
36  };
37 
38  CertificateExtension(CryptoPP::BufferedTransformation& in)
39  {
40  decode(in);
41  }
42 
49  CertificateExtension(const OID& oid, const bool isCritical, const Buffer& value)
50  : m_extensionId(oid), m_isCritical(isCritical), m_extensionValue(value)
51  {
52  }
53 
54  CertificateExtension(const OID& oid, const bool isCritical,
55  const uint8_t* value, size_t valueSize)
56  : m_extensionId(oid), m_isCritical(isCritical), m_extensionValue(value, valueSize)
57  {
58  }
59 
63  virtual
65  {
66  }
67 
68  void
69  encode(CryptoPP::BufferedTransformation& out) const;
70 
71  void
72  decode(CryptoPP::BufferedTransformation& in);
73 
74  inline const OID&
75  getOid() const
76  {
77  return m_extensionId;
78  }
79 
80  inline const bool
81  getIsCritical() const
82  {
83  return m_isCritical;
84  }
85 
86  inline const Buffer&
87  getValue() const
88  {
89  return m_extensionValue;
90  }
91 
92 protected:
96 };
97 
98 } // namespace ndn
99 
100 #endif //NDN_SECURITY_CERTIFICATE_EXTENSION_HPP
void decode(CryptoPP::BufferedTransformation &in)
CertificateExtension(CryptoPP::BufferedTransformation &in)
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)
const Buffer & getValue() const
Definition: oid.hpp:20
void encode(CryptoPP::BufferedTransformation &out) const
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:28