NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: 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; -*- */
2 /*
3  * Copyright (c) 2013-2018 Regents of the University of California.
4  *
5  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6  *
7  * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License as published by the Free Software
9  * Foundation, either version 3 of the License, or (at your option) any later version.
10  *
11  * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13  * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14  *
15  * You should have received copies of the GNU General Public License and GNU Lesser
16  * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17  * <http://www.gnu.org/licenses/>.
18  *
19  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20  *
21  * @author Zhiyi Zhang <dreamerbarrychang@gmail.com>
22  * @author Yingdi Yu <http://irl.cs.ucla.edu/~yingdi/>
23  */
24 
25 #ifndef NDN_SECURITY_V2_CERTIFICATE_HPP
26 #define NDN_SECURITY_V2_CERTIFICATE_HPP
27 
28 #include "ndn-cxx/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
ndn::security::v2::Certificate::Certificate
Certificate()
Definition: certificate.cpp:48
ndn::security::v2::Certificate::getIssuerId
name::Component getIssuerId() const
Get issuer ID.
Definition: certificate.cpp:99
ndn::time::system_clock::TimePoint
time_point TimePoint
Definition: time.hpp:195
ndn::security::v2::Certificate::getIdentity
Name getIdentity() const
Get identity name.
Definition: certificate.cpp:87
ndn::security::v2::Certificate::isValidName
static bool isValidName(const Name &certName)
Check if the specified name follows the naming convention for the certificate.
Definition: certificate.cpp:131
ndn::Buffer
General-purpose automatically managed/resized buffer.
Definition: buffer.hpp:41
ndn::security::v2::Certificate::KEY_COMPONENT
static const name::Component KEY_COMPONENT
Definition: certificate.hpp:172
ndn::security::v2::Certificate::getKeyName
Name getKeyName() const
Get key name.
Definition: certificate.cpp:81
ndn::time::system_clock::now
static time_point now() noexcept
Definition: time.cpp:46
ndn::security::v2::Certificate::getPublicKey
Buffer getPublicKey() const
Get public key bits (in PKCS#8 format)
Definition: certificate.cpp:105
ndn::security::v2::Certificate::isValid
bool isValid(const time::system_clock::TimePoint &ts=time::system_clock::now()) const
Check if the certificate is valid at ts.
Definition: certificate.cpp:119
ndn::Name
Represents an absolute name.
Definition: name.hpp:44
ndn::security::v2::Certificate
The certificate following the certificate format naming convention.
Definition: certificate.hpp:82
ndn::security::v2::Certificate::KEY_COMPONENT_OFFSET
static const ssize_t KEY_COMPONENT_OFFSET
Definition: certificate.hpp:168
ndn::security::v2::Certificate::VERSION_OFFSET
static const ssize_t VERSION_OFFSET
Definition: certificate.hpp:166
ndn::security::ValidityPeriod
Abstraction of validity period.
Definition: validity-period.hpp:38
ndn::security::v2::Certificate::KEY_ID_OFFSET
static const ssize_t KEY_ID_OFFSET
Definition: certificate.hpp:169
ndn::security::v2::operator<<
std::ostream & operator<<(std::ostream &os, const AdditionalDescription &desc)
Definition: additional-description.cpp:167
ndn::security::v2::extractKeyNameFromCertName
Name extractKeyNameFromCertName(const Name &certName)
Extract key name from the certificate name certName.
Definition: certificate.cpp:196
ndn::security::v2::extractIdentityFromCertName
Name extractIdentityFromCertName(const Name &certName)
Extract identity namespace from the certificate name certName.
Definition: certificate.cpp:185
ndn::security::v2::Certificate::getValidityPeriod
ValidityPeriod getValidityPeriod() const
Get validity period of the certificate.
Definition: certificate.cpp:113
ndn::Data
Represents a Data packet.
Definition: data.hpp:36
ndn::security::v2::Certificate::MIN_CERT_NAME_LENGTH
static const size_t MIN_CERT_NAME_LENGTH
Definition: certificate.hpp:170
ndn::security::v2::Certificate::getKeyId
name::Component getKeyId() const
Get key ID.
Definition: certificate.cpp:93
data.hpp
ndn::name::Component
Represents a name component.
Definition: name-component.hpp:94
ndn::Block
Represents a TLV element of NDN packet format.
Definition: block.hpp:43
ndn::security::v2::Certificate::MIN_KEY_NAME_LENGTH
static const size_t MIN_KEY_NAME_LENGTH
Definition: certificate.hpp:171
ndn::security::v2::Certificate::getExtension
const Block & getExtension(uint32_t type) const
Get extension with TLV type.
Definition: certificate.cpp:125
ndn::security::v2::Certificate::ISSUER_ID_OFFSET
static const ssize_t ISSUER_ID_OFFSET
Definition: certificate.hpp:167
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-strategy-choice-helper.hpp:34