NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::SignatureInfo Class Reference

Represents a SignatureInfo TLV element. More...

#include <signature-info.hpp>

Classes

class  Error
 

Public Member Functions

 SignatureInfo ()
 Create an invalid SignatureInfo. More...
 
 SignatureInfo (tlv::SignatureTypeValue type)
 Create with specified type. More...
 
 SignatureInfo (tlv::SignatureTypeValue type, const KeyLocator &keyLocator)
 Create with specified type and KeyLocator. More...
 
 SignatureInfo (const Block &wire)
 Create from wire encoding. More...
 
template<encoding::Tag TAG>
size_t wireEncode (EncodingImpl< TAG > &encoder) const
 Fast encoding or block size estimation. More...
 
const BlockwireEncode () const
 Encode to wire format. More...
 
void wireDecode (const Block &wire)
 Decode from wire format. More...
 
int32_t getSignatureType () const
 Get SignatureType. More...
 
void setSignatureType (tlv::SignatureTypeValue type)
 Set SignatureType. More...
 
bool hasKeyLocator () const
 Check if KeyLocator exists. More...
 
const KeyLocatorgetKeyLocator () const
 Get KeyLocator. More...
 
void setKeyLocator (const KeyLocator &keyLocator)
 Set KeyLocator. More...
 
void unsetKeyLocator ()
 Unset KeyLocator. More...
 
security::ValidityPeriod getValidityPeriod () const
 Get ValidityPeriod. More...
 
void setValidityPeriod (const security::ValidityPeriod &validityPeriod)
 Set ValidityPeriod. More...
 
void unsetValidityPeriod ()
 Unset ValidityPeriod. More...
 
const BlockgetTypeSpecificTlv (uint32_t type) const
 Get SignatureType-specific sub-element. More...
 
void appendTypeSpecificTlv (const Block &element)
 Append SignatureType-specific sub-element. More...
 

Friends

bool operator== (const SignatureInfo &lhs, const SignatureInfo &rhs)
 
std::ostream & operator<< (std::ostream &os, const SignatureInfo &info)
 

Detailed Description

Represents a SignatureInfo TLV element.

Definition at line 34 of file signature-info.hpp.

Constructor & Destructor Documentation

◆ SignatureInfo() [1/4]

ndn::SignatureInfo::SignatureInfo ( )

Create an invalid SignatureInfo.

Definition at line 35 of file signature-info.cpp.

◆ SignatureInfo() [2/4]

ndn::SignatureInfo::SignatureInfo ( tlv::SignatureTypeValue  type)
explicit

Create with specified type.

Definition at line 41 of file signature-info.cpp.

◆ SignatureInfo() [3/4]

ndn::SignatureInfo::SignatureInfo ( tlv::SignatureTypeValue  type,
const KeyLocator keyLocator 
)

Create with specified type and KeyLocator.

Definition at line 47 of file signature-info.cpp.

◆ SignatureInfo() [4/4]

ndn::SignatureInfo::SignatureInfo ( const Block wire)
explicit

Create from wire encoding.

Exceptions
tlv::Errordecode error

Definition at line 54 of file signature-info.cpp.

References wireDecode().

Member Function Documentation

◆ wireEncode() [1/2]

template<encoding::Tag TAG>
size_t ndn::SignatureInfo::wireEncode ( EncodingImpl< TAG > &  encoder) const

Fast encoding or block size estimation.

Parameters
encoderEncodingEstimator or EncodingBuffer instance

Definition at line 61 of file signature-info.cpp.

References NDN_THROW, ndn::encoding::prependNonNegativeIntegerBlock(), ndn::tlv::SignatureInfo, ndn::tlv::SignatureType, and ndn::KeyLocator::wireEncode().

Referenced by ndn::Signature::getInfo(), and ndn::security::v2::KeyChain::sign().

◆ wireEncode() [2/2]

const Block & ndn::SignatureInfo::wireEncode ( ) const

Encode to wire format.

Definition at line 93 of file signature-info.cpp.

References ndn::Block::hasWire().

◆ wireDecode()

void ndn::SignatureInfo::wireDecode ( const Block wire)

◆ getSignatureType()

int32_t ndn::SignatureInfo::getSignatureType ( ) const
inline

Get SignatureType.

Returns
tlv::SignatureTypeValue, or -1 to indicate invalid SignatureInfo

Definition at line 85 of file signature-info.hpp.

Referenced by ndn::security::v2::getKeyLocatorName(), ndn::Signature::getType(), ndn::Signature::operator bool(), and ndn::operator<<().

◆ setSignatureType()

void ndn::SignatureInfo::setSignatureType ( tlv::SignatureTypeValue  type)

Set SignatureType.

Definition at line 145 of file signature-info.cpp.

References ndn::Block::reset().

◆ hasKeyLocator()

bool ndn::SignatureInfo::hasKeyLocator ( ) const
inline

◆ getKeyLocator()

const KeyLocator & ndn::SignatureInfo::getKeyLocator ( ) const

◆ setKeyLocator()

void ndn::SignatureInfo::setKeyLocator ( const KeyLocator keyLocator)

Set KeyLocator.

Definition at line 161 of file signature-info.cpp.

References ndn::Block::reset().

Referenced by ndn::Signature::setKeyLocator().

◆ unsetKeyLocator()

void ndn::SignatureInfo::unsetKeyLocator ( )

Unset KeyLocator.

Definition at line 169 of file signature-info.cpp.

References ndn::tlv::KeyLocator, and ndn::Block::reset().

Referenced by ndn::Signature::unsetKeyLocator().

◆ getValidityPeriod()

security::ValidityPeriod ndn::SignatureInfo::getValidityPeriod ( ) const

Get ValidityPeriod.

Exceptions
ErrorValidityPeriod does not exist

Definition at line 177 of file signature-info.cpp.

References NDN_THROW, and ndn::tlv::ValidityPeriod.

Referenced by ndn::security::v2::Certificate::getValidityPeriod(), and ndn::security::v2::Certificate::isValid().

◆ setValidityPeriod()

void ndn::SignatureInfo::setValidityPeriod ( const security::ValidityPeriod validityPeriod)

Set ValidityPeriod.

Definition at line 187 of file signature-info.cpp.

References unsetValidityPeriod(), and ndn::security::ValidityPeriod::wireEncode().

◆ unsetValidityPeriod()

void ndn::SignatureInfo::unsetValidityPeriod ( )

Unset ValidityPeriod.

Definition at line 194 of file signature-info.cpp.

References ndn::Block::reset(), and ndn::tlv::ValidityPeriod.

Referenced by setValidityPeriod().

◆ getTypeSpecificTlv()

const Block & ndn::SignatureInfo::getTypeSpecificTlv ( uint32_t  type) const

Get SignatureType-specific sub-element.

Parameters
typeTLV-TYPE of sub-element
Exceptions
Errorsub-element of specified type does not exist

Definition at line 203 of file signature-info.cpp.

References NDN_THROW, and ndn::to_string().

Referenced by ndn::security::v2::Certificate::getExtension(), and ndn::security::v2::operator<<().

◆ appendTypeSpecificTlv()

void ndn::SignatureInfo::appendTypeSpecificTlv ( const Block element)

Append SignatureType-specific sub-element.

Definition at line 214 of file signature-info.cpp.

References ndn::Block::reset().

Friends And Related Function Documentation

◆ operator==

bool operator== ( const SignatureInfo lhs,
const SignatureInfo rhs 
)
friend

Definition at line 221 of file signature-info.cpp.

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const SignatureInfo info 
)
friend

Definition at line 229 of file signature-info.cpp.


The documentation for this class was generated from the following files: