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

A Signature is storage for the signature-related information (info and value) in a Data packet. More...

#include <signature.hpp>

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

Classes

class  Error
 

Public Types

enum  { Sha256 = tlv::DigestSha256, Sha256WithRsa = tlv::SignatureSha256WithRsa, Sha256WithEcdsa = tlv::SignatureSha256WithEcdsa }
 

Public Member Functions

 Signature ()=default
 
 Signature (const Block &info, const Block &value=Block())
 
 Signature (const SignatureInfo &info, const Block &value=Block())
 
 operator bool () const
 
const BlockgetInfo () const
 Get SignatureInfo in the wire format. More...
 
const SignatureInfogetSignatureInfo () const
 Get SignatureInfo. More...
 
void setInfo (const Block &info)
 Set SignatureInfo from a block. More...
 
void setInfo (const SignatureInfo &info)
 Set SignatureInfo. More...
 
const BlockgetValue () const
 Get SignatureValue in the wire format. More...
 
void setValue (const Block &value)
 Get SignatureValue from a block. More...
 
uint32_t getType () const
 Get signature type. More...
 
bool hasKeyLocator () const
 Check if SignatureInfo block has a KeyLocator. More...
 
const KeyLocatorgetKeyLocator () const
 Get KeyLocator. More...
 
void setKeyLocator (const KeyLocator &keyLocator)
 Set KeyLocator. More...
 
void unsetKeyLocator ()
 Unset KeyLocator. More...
 
bool operator== (const Signature &other) const
 
bool operator!= (const Signature &other) const
 

Protected Attributes

SignatureInfo m_info
 
Block m_value
 

Detailed Description

A Signature is storage for the signature-related information (info and value) in a Data packet.

Definition at line 33 of file signature.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Deprecated:
use tlv::SignatureTypeValue instead.
Enumerator
Sha256 
Sha256WithRsa 
Sha256WithEcdsa 

Definition at line 47 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 30 of file signature.cpp.

◆ Signature() [3/3]

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

Definition at line 37 of file signature.cpp.

Member Function Documentation

◆ operator bool()

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

Definition at line 61 of file signature.hpp.

References ndn::SignatureInfo::getSignatureType(), and m_info.

◆ getInfo()

◆ getSignatureInfo()

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

Get SignatureInfo.

Definition at line 79 of file signature.hpp.

References m_info, and setInfo().

◆ setInfo() [1/2]

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

Set SignatureInfo from a block.

Exceptions
tlv::Errorif supplied block is not formatted correctly

Definition at line 44 of file signature.cpp.

References m_info, and ndn::tlv::SignatureInfo.

Referenced by getSignatureInfo(), ndn::security::Validator::verifySignature(), and ndn::Data::wireDecode().

◆ setInfo() [2/2]

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

Set SignatureInfo.

Definition at line 96 of file signature.hpp.

References m_info.

◆ getValue()

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

Get SignatureValue in the wire format.

Definition at line 105 of file signature.hpp.

References ndn::Block::encode(), m_value, and setValue().

Referenced by ndn::operator<<(), operator==(), ndn::security::Validator::verifySignature(), and ndn::Data::wireEncode().

◆ setValue()

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

Get SignatureValue from a block.

Exceptions
tlv::Errorif supplied block has type different from SignatureValue

Definition at line 50 of file signature.cpp.

References m_value, ndn::tlv::SignatureValue, and ndn::Block::type().

Referenced by getValue(), ndn::Data::setSignatureValue(), ndn::security::KeyChain::sign(), ndn::security::KeyChain::signByIdentity(), ndn::security::Validator::verifySignature(), and ndn::Data::wireDecode().

◆ getType()

◆ hasKeyLocator()

◆ getKeyLocator()

◆ setKeyLocator()

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

Set KeyLocator.

Definition at line 152 of file signature.hpp.

References m_info, and ndn::SignatureInfo::setKeyLocator().

◆ unsetKeyLocator()

void ndn::Signature::unsetKeyLocator ( )
inline

Unset KeyLocator.

Note that specific signature types may provide advisory (non-virtual) override to prevent unsetting KeyLocator if it is required by the specification.

Definition at line 164 of file signature.hpp.

References m_info, and ndn::SignatureInfo::unsetKeyLocator().

◆ operator==()

bool ndn::Signature::operator== ( const Signature other) const
inline

Definition at line 171 of file signature.hpp.

References getInfo(), and getValue().

◆ operator!=()

bool ndn::Signature::operator!= ( const Signature other) const
inline

Definition at line 178 of file signature.hpp.

Member Data Documentation

◆ m_info

SignatureInfo ndn::Signature::m_info
protected

◆ m_value

Block ndn::Signature::m_value
mutableprotected

Definition at line 185 of file signature.hpp.

Referenced by getValue(), and setValue().


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