ndn::Signature Class Reference

Holds SignatureInfo and SignatureValue in a Data packet. More...

#include <ndn-cxx/signature.hpp>

+ Inheritance diagram for ndn::Signature:
+ Collaboration diagram for ndn::Signature:

Classes

class  Error
 

Public Member Functions

 Signature ()=default
 
 Signature (const Block &info, const Block &value=Block())
 
 Signature (const SignatureInfo &info, const Block &value=Block())
 
const BlockgetInfo () const
 Get SignatureInfo as wire format. More...
 
const KeyLocatorgetKeyLocator () const
 Get KeyLocator. More...
 
const SignatureInfogetSignatureInfo () const
 Get SignatureInfo. More...
 
tlv::SignatureTypeValue getType () const
 Get SignatureType. More...
 
const BlockgetValue () const
 Get SignatureValue. More...
 
bool hasKeyLocator () const
 Check if KeyLocator exists in SignatureInfo. More...
 
 operator bool () const
 Determine whether SignatureInfo is valid. More...
 
void setInfo (const Block &info)
 Decode SignatureInfo from wire format. More...
 
void setInfo (const SignatureInfo &info)
 Set SignatureInfo. More...
 
void setKeyLocator (const KeyLocator &keyLocator)
 Set KeyLocator. More...
 
void setValue (const Block &value)
 Set SignatureValue. More...
 
void unsetKeyLocator ()
 Unset KeyLocator. More...
 

Protected Attributes

SignatureInfo m_info
 
Block m_value
 

Detailed Description

Holds SignatureInfo and SignatureValue in a Data packet.

Deprecated:
Use Data::get/setSignatureInfo and Data::get/setSignatureValue directly

A Signature is not a TLV element itself. It collects SignatureInfo and SignatureValue TLV elements together for easy access. In most cases, an application should use a subclass of Signature such as DigestSha256 , SignatureSha256WithRsa , or SignatureSha256WithEcdsa instead of using Signature type directly.

Definition at line 38 of file signature.hpp.

Constructor & Destructor Documentation

◆ Signature() [1/3]

ndn::Signature::Signature ( )
default

◆ Signature() [2/3]

ndn::Signature::Signature ( const Block info,
const Block value = Block() 
)
explicit

Definition at line 29 of file signature.cpp.

◆ Signature() [3/3]

ndn::Signature::Signature ( const SignatureInfo info,
const Block value = Block() 
)
explicit

Definition at line 36 of file signature.cpp.

Member Function Documentation

◆ getInfo()

const Block& ndn::Signature::getInfo ( ) const
inline

Get SignatureInfo as wire format.

Definition at line 78 of file signature.hpp.

◆ getKeyLocator()

const KeyLocator& ndn::Signature::getKeyLocator ( ) const
inline

Get KeyLocator.

Exceptions
tlv::ErrorKeyLocator does not exist in SignatureInfo

Definition at line 130 of file signature.hpp.

◆ getSignatureInfo()

const SignatureInfo& ndn::Signature::getSignatureInfo ( ) const
inline

Get SignatureInfo.

Definition at line 70 of file signature.hpp.

◆ getType()

tlv::SignatureTypeValue ndn::Signature::getType ( ) const

Get SignatureType.

Exceptions
Errorsignature is invalid

Definition at line 43 of file signature.cpp.

◆ getValue()

const Block& ndn::Signature::getValue ( ) const
inline

Get SignatureValue.

Definition at line 100 of file signature.hpp.

◆ hasKeyLocator()

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

Check if KeyLocator exists in SignatureInfo.

Definition at line 121 of file signature.hpp.

◆ operator bool()

ndn::Signature::operator bool ( ) const
inlineexplicit

Determine whether SignatureInfo is valid.

Definition at line 62 of file signature.hpp.

◆ setInfo() [1/2]

void ndn::Signature::setInfo ( const Block info)

Decode SignatureInfo from wire format.

Exceptions
tlv::Errordecode error

Definition at line 52 of file signature.cpp.

◆ setInfo() [2/2]

void ndn::Signature::setInfo ( const SignatureInfo info)
inline

Set SignatureInfo.

Definition at line 92 of file signature.hpp.

◆ setKeyLocator()

void ndn::Signature::setKeyLocator ( const KeyLocator keyLocator)
inline

Set KeyLocator.

Definition at line 138 of file signature.hpp.

◆ setValue()

void ndn::Signature::setValue ( const Block value)

Set SignatureValue.

Exceptions
tlv::ErrorTLV-TYPE of supplied block is not SignatureValue, or the block does not have TLV-VALUE

Definition at line 58 of file signature.cpp.

◆ unsetKeyLocator()

void ndn::Signature::unsetKeyLocator ( )
inline

Unset KeyLocator.

Note
Subclasses of Signature may provide advisory (non-virtual) override to prevent unsetting KeyLocator if it is required by the specification.

Definition at line 149 of file signature.hpp.

Member Data Documentation

◆ m_info

SignatureInfo ndn::Signature::m_info
protected

Definition at line 155 of file signature.hpp.

◆ m_value

Block ndn::Signature::m_value
mutableprotected

Definition at line 156 of file signature.hpp.