NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
certificate.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
25 #ifndef NDN_SECURITY_V2_CERTIFICATE_HPP
26 #define NDN_SECURITY_V2_CERTIFICATE_HPP
27 
28 #include "../../data.hpp"
29 
30 namespace ndn {
31 namespace security {
32 namespace v2 {
33 
81 class Certificate : public Data
82 {
83 public:
84  Certificate();
85 
90  explicit
91  Certificate(Data&& data);
92 
97  explicit
98  Certificate(const Data& data);
99 
104  explicit
105  Certificate(const Block& block);
106 
110  Name
111  getKeyName() const;
112 
116  Name
117  getIdentity() const;
118 
123  getKeyId() const;
124 
129  getIssuerId() const;
130 
135  Buffer
136  getPublicKey() const;
137 
142  getValidityPeriod() const;
143 
147  bool
149 
154  const Block&
155  getExtension(uint32_t type) const;
156 
157  // @TODO Implement extension enumeration (Issue #3907)
158 public:
162  static bool
163  isValidName(const Name& certName);
164 
165 public:
166  static const ssize_t VERSION_OFFSET;
167  static const ssize_t ISSUER_ID_OFFSET;
168  static const ssize_t KEY_COMPONENT_OFFSET;
169  static const ssize_t KEY_ID_OFFSET;
170  static const size_t MIN_CERT_NAME_LENGTH;
171  static const size_t MIN_KEY_NAME_LENGTH;
173 };
174 
175 std::ostream&
176 operator<<(std::ostream& os, const Certificate& cert);
177 
181 Name
182 extractIdentityFromCertName(const Name& certName);
183 
187 Name
188 extractKeyNameFromCertName(const Name& certName);
189 
190 } // namespace v2
191 } // namespace security
192 } // namespace ndn
193 
194 #endif // NDN_SECURITY_V2_CERTIFICATE_HPP
bool isValid(const time::system_clock::TimePoint &ts=time::system_clock::now()) const
Check if the certificate is valid at ts.
Copyright (c) 2011-2015 Regents of the University of California.
static const ssize_t KEY_ID_OFFSET
The certificate following the certificate format naming convention.
Definition: certificate.hpp:81
Name getKeyName() const
Get key name.
Definition: certificate.cpp:81
static const size_t MIN_KEY_NAME_LENGTH
Name extractKeyNameFromCertName(const Name &certName)
Extract key name from the certificate name certName.
ValidityPeriod getValidityPeriod() const
Get validity period of the certificate.
Represents a TLV element of NDN packet format.
Definition: block.hpp:42
static time_point now() noexcept
Definition: time.cpp:46
static const size_t MIN_CERT_NAME_LENGTH
Catch-all error for security policy errors that don&#39;t fit in other categories.
Definition: base.hpp:79
name::Component getKeyId() const
Get key ID.
Definition: certificate.cpp:93
Abstraction of validity period.
static const ssize_t KEY_COMPONENT_OFFSET
static const ssize_t VERSION_OFFSET
name::Component getIssuerId() const
Get issuer ID.
Definition: certificate.cpp:99
const Block & getExtension(uint32_t type) const
Get extension with TLV type.
Name getIdentity() const
Get identity name.
Definition: certificate.cpp:87
Represents an absolute name.
Definition: name.hpp:42
Buffer getPublicKey() const
Get public key bits (in PKCS#8 format)
time_point TimePoint
Definition: time.hpp:90
std::ostream & operator<<(std::ostream &os, const AdditionalDescription &other)
Component holds a read-only name component value.
static bool isValidName(const Name &certName)
Check if the specified name follows the naming convention for the certificate.
static const name::Component KEY_COMPONENT
static const ssize_t ISSUER_ID_OFFSET
Represents a Data packet.
Definition: data.hpp:35
General-purpose automatically managed/resized buffer.
Definition: buffer.hpp:40
Name extractIdentityFromCertName(const Name &certName)
Extract identity namespace from the certificate name certName.