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.

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 37 of file signature.hpp.

Constructor & Destructor Documentation

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

Definition at line 30 of file signature.cpp.

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

Definition at line 37 of file signature.cpp.

Member Function Documentation

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

Get SignatureInfo as wire format.

Definition at line 73 of file signature.hpp.

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

Get KeyLocator.

Exceptions
tlv::ErrorKeyLocator does not exist in SignatureInfo

Definition at line 125 of file signature.hpp.

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

Get SignatureInfo.

Definition at line 65 of file signature.hpp.

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

Get SignatureType.

Exceptions
Errorsignature is invalid

Definition at line 44 of file signature.cpp.

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

Get SignatureValue.

Definition at line 95 of file signature.hpp.

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

Check if KeyLocator exists in SignatureInfo.

Definition at line 116 of file signature.hpp.

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

Determine whether SignatureInfo is valid.

Definition at line 57 of file signature.hpp.

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

Decode SignatureInfo from wire format.

Exceptions
tlv::Errordecode error

Definition at line 53 of file signature.cpp.

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

Set SignatureInfo.

Definition at line 87 of file signature.hpp.

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

Set KeyLocator.

Definition at line 133 of file signature.hpp.

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 59 of file signature.cpp.

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 144 of file signature.hpp.

Member Data Documentation

SignatureInfo ndn::Signature::m_info
protected

Definition at line 150 of file signature.hpp.

Block ndn::Signature::m_value
mutableprotected

Definition at line 151 of file signature.hpp.