#include <certificate.hpp>
Classes | |
class | Error |
Public Types | |
typedef std::vector< CertificateSubjectDescription > | SubjectDescriptionList |
typedef std::vector< CertificateExtension > | ExtensionList |
Public Member Functions | |
Certificate () | |
The default constructor. More... | |
Certificate (const Data &data) | |
Create a Certificate from the content in the data packet. More... | |
Certificate (const Block &block) | |
Create a Certificate from the a block. More... | |
virtual | ~Certificate () |
void | wireDecode (const Block &wire) |
void | encode () |
encode certificate info into content More... | |
void | addSubjectDescription (const CertificateSubjectDescription &description) |
Add a subject description. More... | |
const SubjectDescriptionList & | getSubjectDescriptionList () const |
SubjectDescriptionList & | getSubjectDescriptionList () |
void | addExtension (const CertificateExtension &extension) |
Add a certificate extension. More... | |
const ExtensionList & | getExtensionList () const |
ExtensionList & | getExtensionList () |
void | setNotBefore (const time::system_clock::TimePoint ¬Before) |
time::system_clock::TimePoint & | getNotBefore () |
const time::system_clock::TimePoint & | getNotBefore () const |
void | setNotAfter (const time::system_clock::TimePoint ¬After) |
time::system_clock::TimePoint & | getNotAfter () |
const time::system_clock::TimePoint & | getNotAfter () const |
void | setPublicKeyInfo (const PublicKey &key) |
PublicKey & | getPublicKeyInfo () |
const PublicKey & | getPublicKeyInfo () const |
bool | isTooEarly () |
Check if the certificate is valid. More... | |
bool | isTooLate () |
Check if the certificate is valid. More... | |
void | printCertificate (std::ostream &os, const std::string &indent="") const |
Public Member Functions inherited from ndn::Data | |
Data () | |
Create an empty Data object. More... | |
Data (const Name &name) | |
Create a new Data object with the given name. More... | |
Data (const Block &wire) | |
Create a new Data object from wire encoding. More... | |
template<encoding::Tag TAG> | |
size_t | wireEncode (EncodingImpl< TAG > &encoder, bool wantUnsignedPortionOnly=false) const |
Fast encoding or block size estimation. More... | |
const Block & | wireEncode () const |
Encode to a wire format. More... | |
const Block & | wireEncode (EncodingBuffer &encoder, const Block &signatureValue) const |
Finalize Data packet encoding with the specified SignatureValue. More... | |
void | wireDecode (const Block &wire) |
Decode from the wire format. More... | |
bool | hasWire () const |
Check if Data is already has wire encoding. More... | |
const Name & | getName () const |
Get name of the Data packet. More... | |
Data & | setName (const Name &name) |
Set name to a copy of the given Name. More... | |
const Name & | getFullName () const |
Get full name of Data packet, including the implicit digest. More... | |
const MetaInfo & | getMetaInfo () const |
Get MetaInfo block from Data packet. More... | |
Data & | setMetaInfo (const MetaInfo &metaInfo) |
Set metaInfo to a copy of the given MetaInfo. More... | |
uint32_t | getContentType () const |
Data & | setContentType (uint32_t type) |
const time::milliseconds & | getFreshnessPeriod () const |
Data & | setFreshnessPeriod (const time::milliseconds &freshnessPeriod) |
const name::Component & | getFinalBlockId () const |
Data & | setFinalBlockId (const name::Component &finalBlockId) |
const Block & | getContent () const |
Get content Block. More... | |
Data & | setContent (const uint8_t *buffer, size_t bufferSize) |
Set the content from the buffer (buffer will be copied) More... | |
Data & | setContent (const Block &block) |
Set the content from the block. More... | |
Data & | setContent (const ConstBufferPtr &contentValue) |
Set the content from the pointer to immutable buffer. More... | |
const Signature & | getSignature () const |
Data & | setSignature (const Signature &signature) |
Set the signature to a copy of the given signature. More... | |
Data & | setSignatureValue (const Block &value) |
bool | operator== (const Data &other) const |
bool | operator!= (const Data &other) const |
Public Member Functions inherited from ndn::TagHost | |
template<typename T > | |
shared_ptr< T > | getTag () const |
get a tag item More... | |
template<typename T > | |
void | setTag (shared_ptr< T > tag) const |
set a tag item More... | |
template<typename T > | |
void | removeTag () const |
remove tag item More... | |
Protected Member Functions | |
void | decode () |
Protected Member Functions inherited from ndn::Data | |
void | onChanged () |
Clear the wire encoding. More... | |
Protected Attributes | |
SubjectDescriptionList | m_subjectDescriptionList |
time::system_clock::TimePoint | m_notBefore |
time::system_clock::TimePoint | m_notAfter |
PublicKey | m_key |
ExtensionList | m_extensionList |
Definition at line 39 of file certificate.hpp.
typedef std::vector<CertificateSubjectDescription> ndn::security::v1::Certificate::SubjectDescriptionList |
Definition at line 52 of file certificate.hpp.
typedef std::vector<CertificateExtension> ndn::security::v1::Certificate::ExtensionList |
Definition at line 53 of file certificate.hpp.
ndn::security::v1::Certificate::Certificate | ( | ) |
The default constructor.
Definition at line 45 of file certificate.cpp.
|
explicit |
Create a Certificate from the content in the data packet.
data | The data packet with the content to decode. |
Definition at line 51 of file certificate.cpp.
References decode().
|
explicit |
Create a Certificate from the a block.
block | The raw block of the certificate |
Definition at line 58 of file certificate.cpp.
References decode().
|
virtual |
Definition at line 64 of file certificate.cpp.
void ndn::security::v1::Certificate::wireDecode | ( | const Block & | wire | ) |
Definition at line 69 of file certificate.cpp.
References decode(), and ndn::Data::wireDecode().
Referenced by ndn::security::v1::IdentityCertificate::wireDecode().
void ndn::security::v1::Certificate::encode | ( | ) |
encode certificate info into content
Definition at line 94 of file certificate.cpp.
References ndn::OBufferStream::buf(), ndn::tlv::ContentType_Key, ndn::DEREncodeGeneralTime(), ndn::security::v1::PublicKey::encode(), m_extensionList, m_key, m_notAfter, m_notBefore, m_subjectDescriptionList, ndn::Data::setContent(), and ndn::Data::setContentType().
|
inline |
Add a subject description.
description | The description to be added. |
Definition at line 91 of file certificate.hpp.
References m_subjectDescriptionList.
|
inline |
Definition at line 97 of file certificate.hpp.
References m_subjectDescriptionList.
|
inline |
Definition at line 103 of file certificate.hpp.
References m_subjectDescriptionList.
|
inline |
Add a certificate extension.
extension | the extension to be added |
Definition at line 113 of file certificate.hpp.
References m_extensionList.
|
inline |
Definition at line 119 of file certificate.hpp.
References m_extensionList.
|
inline |
Definition at line 125 of file certificate.hpp.
References m_extensionList.
|
inline |
Definition at line 131 of file certificate.hpp.
References m_notBefore.
|
inline |
Definition at line 137 of file certificate.hpp.
References m_notBefore.
Referenced by ndn::security::SecPublicInfoSqlite3::addCertificate().
|
inline |
Definition at line 143 of file certificate.hpp.
References m_notBefore.
|
inline |
Definition at line 149 of file certificate.hpp.
References m_notAfter.
|
inline |
Definition at line 155 of file certificate.hpp.
References m_notAfter.
Referenced by ndn::security::SecPublicInfoSqlite3::addCertificate().
|
inline |
Definition at line 161 of file certificate.hpp.
References m_notAfter.
|
inline |
Definition at line 167 of file certificate.hpp.
References m_key.
|
inline |
Definition at line 173 of file certificate.hpp.
References m_key.
Referenced by ndn::security::SecPublicInfoSqlite3::addCertificate(), ndn::security::PibMemory::addCertificate(), ndn::security::PibSqlite3::addCertificate(), and ndn::security::KeyChain::selfSign().
|
inline |
Definition at line 179 of file certificate.hpp.
References decode(), isTooEarly(), isTooLate(), m_key, and printCertificate().
bool ndn::security::v1::Certificate::isTooEarly | ( | ) |
Check if the certificate is valid.
Definition at line 76 of file certificate.cpp.
References m_notBefore, and ndn::time::system_clock::now().
Referenced by getPublicKeyInfo().
bool ndn::security::v1::Certificate::isTooLate | ( | ) |
Check if the certificate is valid.
Definition at line 85 of file certificate.cpp.
References m_notAfter, and ndn::time::system_clock::now().
Referenced by getPublicKeyInfo().
void ndn::security::v1::Certificate::printCertificate | ( | std::ostream & | os, |
const std::string & | indent = "" |
||
) | const |
Definition at line 269 of file certificate.cpp.
References ndn::tlv::DigestSha256, ndn::EC, ndn::security::v1::PublicKey::encode(), ndn::Signature::getKeyLocator(), ndn::security::v1::PublicKey::getKeyType(), ndn::KeyLocator::getName(), ndn::Data::getName(), ndn::Data::getSignature(), ndn::KeyLocator::getType(), ndn::Name::isPrefixOf(), ndn::KeyLocator::KeyLocator_KeyDigest, ndn::KeyLocator::KeyLocator_Name, ndn::KeyLocator::KeyLocator_None, m_key, m_notAfter, m_notBefore, m_subjectDescriptionList, ndn::RSA, ndn::tlv::SignatureSha256WithEcdsa, ndn::tlv::SignatureSha256WithRsa, and ndn::time::toIsoString().
Referenced by getPublicKeyInfo(), and ndn::security::v1::operator<<().
|
protected |
Definition at line 197 of file certificate.cpp.
References ndn::BERDecodeTime(), ndn::security::v1::PublicKey::decode(), ndn::Data::getContent(), m_extensionList, m_key, m_notAfter, m_notBefore, and m_subjectDescriptionList.
Referenced by Certificate(), getPublicKeyInfo(), and wireDecode().
|
protected |
Definition at line 206 of file certificate.hpp.
Referenced by addSubjectDescription(), decode(), encode(), getSubjectDescriptionList(), and printCertificate().
|
protected |
Definition at line 207 of file certificate.hpp.
Referenced by decode(), encode(), getNotBefore(), isTooEarly(), printCertificate(), and setNotBefore().
|
protected |
Definition at line 208 of file certificate.hpp.
Referenced by decode(), encode(), getNotAfter(), isTooLate(), printCertificate(), and setNotAfter().
|
protected |
Definition at line 209 of file certificate.hpp.
Referenced by decode(), encode(), getPublicKeyInfo(), printCertificate(), and setPublicKeyInfo().
|
protected |
Definition at line 210 of file certificate.hpp.
Referenced by addExtension(), decode(), encode(), and getExtensionList().