ndn::security::v1::IdentityCertificate Class Reference

#include <identity-certificate.hpp>

+ Inheritance diagram for ndn::security::v1::IdentityCertificate:
+ Collaboration diagram for ndn::security::v1::IdentityCertificate:

Classes

class  Error
 

Public Types

typedef std::vector< CertificateExtensionExtensionList
 
typedef std::vector< CertificateSubjectDescriptionSubjectDescriptionList
 

Public Member Functions

 IdentityCertificate ()
 The default constructor. More...
 
 IdentityCertificate (const Data &data)
 Create an IdentityCertificate from the content in the data packet. More...
 
 IdentityCertificate (const Block &block)
 Create an IdentityCertificate from a block. More...
 
void addExtension (const CertificateExtension &extension)
 Add a certificate extension. More...
 
void addSubjectDescription (const CertificateSubjectDescription &description)
 Add a subject description. More...
 
void encode ()
 encode certificate info into content More...
 
const BlockgetContent () const
 Get Content. More...
 
uint32_t getContentType () const
 
const ExtensionListgetExtensionList () const
 
ExtensionListgetExtensionList ()
 
const name::ComponentgetFinalBlockId () const
 
const time::milliseconds & getFreshnessPeriod () const
 
const NamegetFullName () const
 Get full name including implicit digest. More...
 
const MetaInfogetMetaInfo () const
 Get MetaInfo. More...
 
const NamegetName () const
 Get name. More...
 
time::system_clock::TimePointgetNotAfter ()
 
const time::system_clock::TimePointgetNotAfter () const
 
time::system_clock::TimePointgetNotBefore ()
 
const time::system_clock::TimePointgetNotBefore () const
 
PublicKeygetPublicKeyInfo ()
 
const PublicKeygetPublicKeyInfo () const
 
const NamegetPublicKeyName () const
 
const SignaturegetSignature () const
 Get Signature. More...
 
const SubjectDescriptionListgetSubjectDescriptionList () const
 
SubjectDescriptionListgetSubjectDescriptionList ()
 
template<typename T >
shared_ptr< T > getTag () const
 get a tag item More...
 
bool hasWire () const
 Check if already has wire. More...
 
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
 
template<typename T >
void removeTag () const
 remove tag item More...
 
DatasetContent (const Block &block)
 Set Content from a block. More...
 
DatasetContent (const uint8_t *value, size_t valueSize)
 Copy Content value from raw buffer. More...
 
DatasetContent (const ConstBufferPtr &value)
 Set Content from wire buffer. More...
 
DatasetContentType (uint32_t type)
 
DatasetFinalBlockId (const name::Component &finalBlockId)
 
DatasetFreshnessPeriod (const time::milliseconds &freshnessPeriod)
 
DatasetMetaInfo (const MetaInfo &metaInfo)
 Set MetaInfo. More...
 
void setName (const Name &name)
 
void setNotAfter (const time::system_clock::TimePoint &notAfter)
 
void setNotBefore (const time::system_clock::TimePoint &notBefore)
 
void setPublicKeyInfo (const PublicKey &key)
 
DatasetSignature (const Signature &signature)
 Set Signature. More...
 
DatasetSignatureValue (const Block &value)
 Set SignatureValue. More...
 
template<typename T >
void setTag (shared_ptr< T > tag) const
 set a tag item More...
 
void wireDecode (const Block &wire)
 
template<encoding::Tag TAG>
size_t wireEncode (EncodingImpl< TAG > &encoder, bool wantUnsignedPortionOnly=false) const
 Fast encoding or block size estimation. More...
 
const BlockwireEncode (EncodingBuffer &encoder, const Block &signatureValue) const
 Finalize Data packet encoding with the specified SignatureValue. More...
 
const BlockwireEncode () const
 Encode to a wire format. More...
 

Static Public Member Functions

static Name certificateNameToPublicKeyName (const Name &certificateName)
 Get the public key name from the full certificate name. More...
 
static bool isIdentityCertificate (const Certificate &certificate)
 

Protected Member Functions

void decode ()
 
void resetWire ()
 Clear wire encoding and cached FullName. More...
 

Protected Attributes

ExtensionList m_extensionList
 
PublicKey m_key
 
time::system_clock::TimePoint m_notAfter
 
time::system_clock::TimePoint m_notBefore
 
Name m_publicKeyName
 
SubjectDescriptionList m_subjectDescriptionList
 

Detailed Description

Definition at line 34 of file identity-certificate.hpp.

Member Typedef Documentation

Definition at line 53 of file v1/certificate.hpp.

Constructor & Destructor Documentation

ndn::security::v1::IdentityCertificate::IdentityCertificate ( )

The default constructor.

Definition at line 36 of file identity-certificate.cpp.

ndn::security::v1::IdentityCertificate::IdentityCertificate ( const Data data)
explicit

Create an IdentityCertificate from the content in the data packet.

Parameters
dataThe data packet with the content to decode.

Definition at line 41 of file identity-certificate.cpp.

ndn::security::v1::IdentityCertificate::IdentityCertificate ( const Block block)
explicit

Create an IdentityCertificate from a block.

Parameters
blockThe raw block of the certificate.

Definition at line 47 of file identity-certificate.cpp.

Member Function Documentation

void ndn::security::v1::Certificate::addExtension ( const CertificateExtension extension)
inlineinherited

Add a certificate extension.

Parameters
extensionthe extension to be added

Definition at line 113 of file v1/certificate.hpp.

void ndn::security::v1::Certificate::addSubjectDescription ( const CertificateSubjectDescription description)
inlineinherited

Add a subject description.

Parameters
descriptionThe description to be added.

Definition at line 91 of file v1/certificate.hpp.

Name ndn::security::v1::IdentityCertificate::certificateNameToPublicKeyName ( const Name certificateName)
static

Get the public key name from the full certificate name.

Parameters
certificateNameThe full certificate name.
Returns
The related public key name.

Definition at line 109 of file identity-certificate.cpp.

void ndn::security::v1::Certificate::decode ( )
protectedinherited

Definition at line 197 of file v1/certificate.cpp.

void ndn::security::v1::Certificate::encode ( )
inherited

encode certificate info into content

Definition at line 94 of file v1/certificate.cpp.

const Block & ndn::Data::getContent ( ) const
inherited

Get Content.

The Content value is accessible through value()/value_size() or value_begin()/value_end() methods of the Block class.

Definition at line 185 of file data.cpp.

uint32_t ndn::Data::getContentType ( ) const
inlineinherited

Definition at line 201 of file data.hpp.

const ExtensionList& ndn::security::v1::Certificate::getExtensionList ( ) const
inlineinherited

Definition at line 119 of file v1/certificate.hpp.

ExtensionList& ndn::security::v1::Certificate::getExtensionList ( )
inlineinherited

Definition at line 125 of file v1/certificate.hpp.

const name::Component& ndn::Data::getFinalBlockId ( ) const
inlineinherited

Definition at line 219 of file data.hpp.

const time::milliseconds& ndn::Data::getFreshnessPeriod ( ) const
inlineinherited

Definition at line 210 of file data.hpp.

const Name & ndn::Data::getFullName ( ) const
inherited

Get full name including implicit digest.

Precondition
hasWire() == true; i.e. wireEncode() must have been called
Exceptions
ErrorData has no wire encoding

Definition at line 148 of file data.cpp.

const MetaInfo& ndn::Data::getMetaInfo ( ) const
inlineinherited

Get MetaInfo.

Definition at line 135 of file data.hpp.

const Name& ndn::Data::getName ( ) const
inlineinherited

Get name.

Definition at line 121 of file data.hpp.

time::system_clock::TimePoint& ndn::security::v1::Certificate::getNotAfter ( )
inlineinherited

Definition at line 155 of file v1/certificate.hpp.

const time::system_clock::TimePoint& ndn::security::v1::Certificate::getNotAfter ( ) const
inlineinherited

Definition at line 161 of file v1/certificate.hpp.

time::system_clock::TimePoint& ndn::security::v1::Certificate::getNotBefore ( )
inlineinherited

Definition at line 137 of file v1/certificate.hpp.

const time::system_clock::TimePoint& ndn::security::v1::Certificate::getNotBefore ( ) const
inlineinherited

Definition at line 143 of file v1/certificate.hpp.

PublicKey& ndn::security::v1::Certificate::getPublicKeyInfo ( )
inlineinherited

Definition at line 173 of file v1/certificate.hpp.

const PublicKey& ndn::security::v1::Certificate::getPublicKeyInfo ( ) const
inlineinherited

Definition at line 179 of file v1/certificate.hpp.

const Name& ndn::security::v1::IdentityCertificate::getPublicKeyName ( ) const
inline

Definition at line 73 of file identity-certificate.hpp.

const Signature& ndn::Data::getSignature ( ) const
inlineinherited

Get Signature.

Definition at line 182 of file data.hpp.

const SubjectDescriptionList& ndn::security::v1::Certificate::getSubjectDescriptionList ( ) const
inlineinherited

Definition at line 97 of file v1/certificate.hpp.

SubjectDescriptionList& ndn::security::v1::Certificate::getSubjectDescriptionList ( )
inlineinherited

Definition at line 103 of file v1/certificate.hpp.

template<typename T >
shared_ptr< T > ndn::TagHost::getTag ( ) const
inlineinherited

get a tag item

Template Parameters
Ttype of the tag, which must be a subclass of ndn::Tag
Return values
nullptrif no Tag of type T is stored

Definition at line 67 of file tag-host.hpp.

bool ndn::Data::hasWire ( ) const
inlineinherited

Check if already has wire.

Definition at line 105 of file data.hpp.

bool ndn::security::v1::IdentityCertificate::isIdentityCertificate ( const Certificate certificate)
static

Definition at line 103 of file identity-certificate.cpp.

bool ndn::security::v1::Certificate::isTooEarly ( )
inherited

Check if the certificate is valid.

Returns
True if the current time is earlier than notBefore.

Definition at line 76 of file v1/certificate.cpp.

bool ndn::security::v1::Certificate::isTooLate ( )
inherited

Check if the certificate is valid.

Returns
True if the current time is later than notAfter.

Definition at line 85 of file v1/certificate.cpp.

void ndn::security::v1::Certificate::printCertificate ( std::ostream &  os,
const std::string &  indent = "" 
) const
inherited

Definition at line 269 of file v1/certificate.cpp.

template<typename T >
void ndn::TagHost::removeTag ( ) const
inlineinherited

remove tag item

Note
Tag can be removed even on a const tag host instance

Definition at line 94 of file tag-host.hpp.

void ndn::Data::resetWire ( )
protectedinherited

Clear wire encoding and cached FullName.

Note
This does not clear the SignatureValue.

Definition at line 162 of file data.cpp.

Data & ndn::Data::setContent ( const Block block)
inherited

Set Content from a block.

If block's TLV-TYPE is Content, it will be used directly as Data's Content element. If block's TLV-TYPE is not Content, it will be nested into a Content element.

Returns
a reference to this Data, to allow chaining

Definition at line 194 of file data.cpp.

Data & ndn::Data::setContent ( const uint8_t *  value,
size_t  valueSize 
)
inherited

Copy Content value from raw buffer.

Parameters
valuepointer to the first octet of the value
valueSizesize of the raw buffer
Returns
a reference to this Data, to allow chaining

Definition at line 209 of file data.cpp.

Data & ndn::Data::setContent ( const ConstBufferPtr value)
inherited

Set Content from wire buffer.

Parameters
valueContent value, which does not need to be a TLV element
Returns
a reference to this Data, to allow chaining

Definition at line 217 of file data.cpp.

Data & ndn::Data::setContentType ( uint32_t  type)
inherited

Definition at line 241 of file data.cpp.

Data & ndn::Data::setFinalBlockId ( const name::Component finalBlockId)
inherited

Definition at line 257 of file data.cpp.

Data & ndn::Data::setFreshnessPeriod ( const time::milliseconds &  freshnessPeriod)
inherited

Definition at line 249 of file data.cpp.

Data & ndn::Data::setMetaInfo ( const MetaInfo metaInfo)
inherited

Set MetaInfo.

Returns
a reference to this Data, to allow chaining

Definition at line 177 of file data.cpp.

void ndn::security::v1::IdentityCertificate::setName ( const Name name)

Definition at line 61 of file identity-certificate.cpp.

void ndn::security::v1::Certificate::setNotAfter ( const time::system_clock::TimePoint notAfter)
inlineinherited

Definition at line 149 of file v1/certificate.hpp.

void ndn::security::v1::Certificate::setNotBefore ( const time::system_clock::TimePoint notBefore)
inlineinherited

Definition at line 131 of file v1/certificate.hpp.

void ndn::security::v1::Certificate::setPublicKeyInfo ( const PublicKey key)
inlineinherited

Definition at line 167 of file v1/certificate.hpp.

Data & ndn::Data::setSignature ( const Signature signature)
inherited

Set Signature.

Returns
a reference to this Data, to allow chaining

Definition at line 225 of file data.cpp.

Data & ndn::Data::setSignatureValue ( const Block value)
inherited

Set SignatureValue.

Returns
a reference to this Data, to allow chaining

Definition at line 233 of file data.cpp.

template<typename T >
void ndn::TagHost::setTag ( shared_ptr< T >  tag) const
inlineinherited

set a tag item

Template Parameters
Ttype of the tag, which must be a subclass of ndn::Tag
Note
Tag can be set even on a const tag host instance

Definition at line 80 of file tag-host.hpp.

void ndn::security::v1::IdentityCertificate::wireDecode ( const Block wire)

Definition at line 54 of file identity-certificate.cpp.

template<encoding::Tag TAG>
size_t ndn::Data::wireEncode ( EncodingImpl< TAG > &  encoder,
bool  wantUnsignedPortionOnly = false 
) const
inherited

Fast encoding or block size estimation.

Parameters
encoderEncodingEstimator or EncodingBuffer instance
wantUnsignedPortionOnlyIf true, only prepends Name, MetaInfo, Content, and SignatureInfo to encoder, but omit SignatureValue and outmost Type-Length of Data element. This is intended to be used with wireEncode(encoder, signatureValue).
Exceptions
ErrorSignatureBits are not provided and wantUnsignedPortionOnly is false.

Definition at line 48 of file data.cpp.

const Block & ndn::Data::wireEncode ( EncodingBuffer &  encoder,
const Block signatureValue 
) const
inherited

Finalize Data packet encoding with the specified SignatureValue.

Parameters
encoderEncodingBuffer containing Name, MetaInfo, Content, and SignatureInfo, but without SignatureValue or outmost Type-Length of Data element
signatureValueSignatureValue element

This method is intended to be used in concert with Data::wireEncode(encoder, true)

Data data;
...
EncodingBuffer encoder;
data.wireEncode(encoder, true);
...
Block signatureValue = <sign_over_unsigned_portion>(encoder.buf(), encoder.size());
data.wireEncode(encoder, signatureValue)

Definition at line 93 of file data.cpp.

const Block & ndn::Data::wireEncode ( ) const
inherited

Encode to a wire format.

Definition at line 106 of file data.cpp.

Member Data Documentation

ExtensionList ndn::security::v1::Certificate::m_extensionList
protectedinherited

Definition at line 210 of file v1/certificate.hpp.

PublicKey ndn::security::v1::Certificate::m_key
protectedinherited

Definition at line 209 of file v1/certificate.hpp.

time::system_clock::TimePoint ndn::security::v1::Certificate::m_notAfter
protectedinherited

Definition at line 208 of file v1/certificate.hpp.

time::system_clock::TimePoint ndn::security::v1::Certificate::m_notBefore
protectedinherited

Definition at line 207 of file v1/certificate.hpp.

Name ndn::security::v1::IdentityCertificate::m_publicKeyName
protected

Definition at line 97 of file identity-certificate.hpp.

SubjectDescriptionList ndn::security::v1::Certificate::m_subjectDescriptionList
protectedinherited

Definition at line 206 of file v1/certificate.hpp.