NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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...
 
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
Deprecated:
use tlv::SignatureTypeValue instead.
Enumerator
Sha256 
Sha256WithRsa 
Sha256WithEcdsa 

Definition at line 47 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

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

Definition at line 61 of file signature.hpp.

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

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 getInfo(), and ndn::Data::wireDecode().

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

Set SignatureInfo.

Definition at line 87 of file signature.hpp.

References m_info.

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

Get SignatureValue in the wire format.

Definition at line 96 of file signature.hpp.

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

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

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(), and ndn::Data::wireDecode().

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

Set KeyLocator.

Definition at line 143 of file signature.hpp.

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

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

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

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

Definition at line 162 of file signature.hpp.

References getInfo(), and getValue().

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

Definition at line 169 of file signature.hpp.

Member Data Documentation

SignatureInfo ndn::Signature::m_info
protected
Block ndn::Signature::m_value
mutableprotected

Definition at line 176 of file signature.hpp.

Referenced by getValue(), and setValue().


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