Represents a SignatureInfo or InterestSignatureInfo TLV element. More...
#include <ndn-cxx/signature-info.hpp>
Classes | |
class | Error |
Public Types | |
enum | Type : uint32_t { Type::Data = tlv::SignatureInfo, Type::Interest = tlv::InterestSignatureInfo } |
Public Member Functions | |
SignatureInfo () | |
SignatureInfo (tlv::SignatureTypeValue type, optional< KeyLocator > keyLocator=nullopt) | |
Create with the specified type and KeyLocator. More... | |
SignatureInfo (const Block &wire, Type type=Type::Data) | |
Create from wire encoding. More... | |
void | addCustomTlv (Block block) |
Append an arbitrary TLV element to this SignatureInfo. More... | |
void | appendTypeSpecificTlv (const Block &block) |
Append SignatureType-specific sub-element. More... | |
optional< Block > | getCustomTlv (uint32_t type) const |
Get first custom TLV element with the specified TLV-TYPE. More... | |
const KeyLocator & | getKeyLocator () const |
Get KeyLocator. More... | |
optional< std::vector< uint8_t > > | getNonce () const |
Get SignatureNonce. More... | |
optional< uint64_t > | getSeqNum () const |
Get SignatureSeqNum. More... | |
int32_t | getSignatureType () const noexcept |
Get SignatureType. More... | |
optional< time::system_clock::time_point > | getTime () const |
Get SignatureTime. More... | |
const Block & | getTypeSpecificTlv (uint32_t type) const |
Get SignatureType-specific sub-element. More... | |
security::ValidityPeriod | getValidityPeriod () const |
Get ValidityPeriod. More... | |
bool | hasKeyLocator () const noexcept |
Check if KeyLocator is present. More... | |
bool | hasWire () const noexcept |
Check if this instance has cached wire encoding. More... | |
operator bool () const noexcept | |
Determine whether SignatureInfo is valid. More... | |
void | removeCustomTlv (uint32_t type) |
Remove all arbitrary TLV elements with the specified TLV-TYPE from this SignatureInfo. More... | |
SignatureInfo & | setKeyLocator (optional< KeyLocator > keyLocator) |
Set KeyLocator. More... | |
SignatureInfo & | setNonce (optional< std::vector< uint8_t >> nonce) |
Append or replace SignatureNonce. More... | |
SignatureInfo & | setSeqNum (optional< uint64_t > seqNum) |
Append or replace SignatureSeqNum. More... | |
SignatureInfo & | setSignatureType (tlv::SignatureTypeValue type) |
Set SignatureType. More... | |
SignatureInfo & | setTime (optional< time::system_clock::time_point > time=time::system_clock::now()) |
Append or replace SignatureTime. More... | |
SignatureInfo & | setValidityPeriod (optional< security::ValidityPeriod > validityPeriod) |
Append or replace ValidityPeriod. More... | |
void | unsetKeyLocator () |
Remove KeyLocator. More... | |
void | unsetValidityPeriod () |
Remove ValidityPeriod. More... | |
void | wireDecode (const Block &wire, Type type=Type::Data) |
Decode from wire format. More... | |
template<encoding::Tag TAG> | |
size_t | wireEncode (EncodingImpl< TAG > &encoder, Type type=Type::Data) const |
Fast encoding or block size estimation. More... | |
const Block & | wireEncode (Type type=Type::Data) const |
Encode to wire format. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const SignatureInfo &info) |
bool | operator== (const SignatureInfo &lhs, const SignatureInfo &rhs) |
Represents a SignatureInfo or InterestSignatureInfo TLV element.
Definition at line 32 of file signature-info.hpp.
|
strong |
Enumerator | |
---|---|
Data | |
Interest |
Definition at line 41 of file signature-info.hpp.
|
default |
|
explicit |
Create with the specified type and KeyLocator.
Definition at line 40 of file signature-info.cpp.
|
explicit |
Create from wire encoding.
wire | Wire to decode from |
type | Which type of SignatureInfo block decoding should expect |
tlv::Error | Decode error |
Definition at line 46 of file signature-info.cpp.
void ndn::SignatureInfo::addCustomTlv | ( | Block | block | ) |
Append an arbitrary TLV element to this SignatureInfo.
If an element of the same TLV-TYPE already exists, it will be replaced by the new element.
Definition at line 319 of file signature-info.cpp.
void ndn::SignatureInfo::appendTypeSpecificTlv | ( | const Block & | block | ) |
Append SignatureType-specific sub-element.
Definition at line 358 of file signature-info.cpp.
optional< Block > ndn::SignatureInfo::getCustomTlv | ( | uint32_t | type | ) | const |
Get first custom TLV element with the specified TLV-TYPE.
type | TLV-TYPE of element to get |
nullopt | No custom TLV elements with the specified TLV-TYPE exist |
Definition at line 309 of file signature-info.cpp.
const KeyLocator & ndn::SignatureInfo::getKeyLocator | ( | ) | const |
Get KeyLocator.
Error | This SignatureInfo does not contain a KeyLocator |
Definition at line 190 of file signature-info.cpp.
optional< std::vector< uint8_t > > ndn::SignatureInfo::getNonce | ( | ) | const |
Get SignatureNonce.
nullopt | SignatureNonce is not set |
Definition at line 243 of file signature-info.cpp.
optional< uint64_t > ndn::SignatureInfo::getSeqNum | ( | ) | const |
Get SignatureSeqNum.
nullopt | SignatureSeqNum is not set |
Definition at line 287 of file signature-info.cpp.
|
inlinenoexcept |
Get SignatureType.
Definition at line 113 of file signature-info.hpp.
optional< time::system_clock::time_point > ndn::SignatureInfo::getTime | ( | ) | const |
Get SignatureTime.
nullopt | SignatureTime is not set |
Definition at line 265 of file signature-info.cpp.
const Block & ndn::SignatureInfo::getTypeSpecificTlv | ( | uint32_t | type | ) | const |
Get SignatureType-specific sub-element.
type | TLV-TYPE of sub-element |
Error | Sub-element of specified type does not exist |
Definition at line 348 of file signature-info.cpp.
security::ValidityPeriod ndn::SignatureInfo::getValidityPeriod | ( | ) | const |
Get ValidityPeriod.
Error | This SignatureInfo does not contain a ValidityPeriod |
Definition at line 215 of file signature-info.cpp.
|
inlinenoexcept |
Check if KeyLocator is present.
Definition at line 127 of file signature-info.hpp.
|
inlinenoexcept |
Check if this instance has cached wire encoding.
Definition at line 103 of file signature-info.hpp.
|
inlineexplicitnoexcept |
Determine whether SignatureInfo is valid.
Definition at line 65 of file signature-info.hpp.
void ndn::SignatureInfo::removeCustomTlv | ( | uint32_t | type | ) |
Remove all arbitrary TLV elements with the specified TLV-TYPE from this SignatureInfo.
type | TLV-TYPE of elements to remove |
Definition at line 335 of file signature-info.cpp.
SignatureInfo & ndn::SignatureInfo::setKeyLocator | ( | optional< KeyLocator > | keyLocator | ) |
Set KeyLocator.
Passing nullopt
will remove the KeyLocator.
Definition at line 199 of file signature-info.cpp.
SignatureInfo & ndn::SignatureInfo::setNonce | ( | optional< std::vector< uint8_t >> | nonce | ) |
Append or replace SignatureNonce.
Passing nullopt
will remove the SignatureNonce.
Definition at line 253 of file signature-info.cpp.
SignatureInfo & ndn::SignatureInfo::setSeqNum | ( | optional< uint64_t > | seqNum | ) |
Append or replace SignatureSeqNum.
Passing nullopt
will remove the SignatureSeqNum.
Definition at line 297 of file signature-info.cpp.
SignatureInfo & ndn::SignatureInfo::setSignatureType | ( | tlv::SignatureTypeValue | type | ) |
Set SignatureType.
Definition at line 180 of file signature-info.cpp.
SignatureInfo & ndn::SignatureInfo::setTime | ( | optional< time::system_clock::time_point > | time = time::system_clock::now() | ) |
Append or replace SignatureTime.
Passing nullopt
will remove the SignatureTime.
Definition at line 275 of file signature-info.cpp.
SignatureInfo & ndn::SignatureInfo::setValidityPeriod | ( | optional< security::ValidityPeriod > | validityPeriod | ) |
Append or replace ValidityPeriod.
Passing nullopt
will remove the ValidityPeriod.
Definition at line 225 of file signature-info.cpp.
void ndn::SignatureInfo::unsetKeyLocator | ( | ) |
Remove KeyLocator.
setKeyLocator(nullopt)
Definition at line 209 of file signature-info.cpp.
void ndn::SignatureInfo::unsetValidityPeriod | ( | ) |
Remove ValidityPeriod.
setValidityPeriod(nullopt)
Definition at line 237 of file signature-info.cpp.
void ndn::SignatureInfo::wireDecode | ( | const Block & | wire, |
SignatureInfo::Type | type = Type::Data |
||
) |
Decode from wire format.
wire | Wire to decode from |
type | Which type of SignatureInfo block decoding should expect |
tlv::Error | Decode error |
Definition at line 117 of file signature-info.cpp.
size_t ndn::SignatureInfo::wireEncode | ( | EncodingImpl< TAG > & | encoder, |
SignatureInfo::Type | type = Type::Data |
||
) | const |
Fast encoding or block size estimation.
encoder | EncodingEstimator or EncodingBuffer instance |
type | Which type of SignatureInfo block to encode |
Elements are encoded in the following order: SignatureType, KeyLocator (if present), and other elements in the order they were set (changing the value of an already present element will not change that element's encoding order).
Definition at line 53 of file signature-info.cpp.
const Block & ndn::SignatureInfo::wireEncode | ( | SignatureInfo::Type | type = Type::Data | ) | const |
Encode to wire format.
type | Which type of SignatureInfo block to encode |
Elements are encoded in the following order: SignatureType, KeyLocator (if present), and other elements in the order they were set (changing the value of an already present element will not change that element's encoding order).
Definition at line 101 of file signature-info.cpp.
|
friend |
Definition at line 380 of file signature-info.cpp.
|
friend |
Definition at line 372 of file signature-info.cpp.