Represents a SignatureInfo
or InterestSignatureInfo
TLV element.
More...
#include <ndn-cxx/signature-info.hpp>
Classes | |
class | Error |
Public Types | |
enum class | Type : uint32_t { Data = tlv::SignatureInfo , Interest = tlv::InterestSignatureInfo } |
Public Member Functions | |
SignatureInfo () | |
SignatureInfo (const Block &wire, Type type=Type::Data) | |
Create from wire encoding. More... | |
SignatureInfo (tlv::SignatureTypeValue type, optional< KeyLocator > keyLocator=nullopt) | |
Create with the specified type and KeyLocator. More... | |
void | addCustomTlv (Block block) |
Append an arbitrary TLV element to this SignatureInfo. More... | |
optional< Block > | getCustomTlv (uint32_t type) const |
Get first custom TLV element with the specified TLV-TYPE. More... | |
const KeyLocator & | getKeyLocator () const |
Get the KeyLocator element. 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 the SignatureType . More... | |
optional< time::system_clock::time_point > | getTime () const |
Get SignatureTime. More... | |
security::ValidityPeriod | getValidityPeriod () const |
Get the ValidityPeriod element. 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 or unset the KeyLocator element. More... | |
SignatureInfo & | setNonce (optional< span< const 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 the 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, replace, or remove the ValidityPeriod element. 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 33 of file signature-info.hpp.
|
strong |
Enumerator | |
---|---|
Data | |
Interest |
Definition at line 42 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 308 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 298 of file signature-info.cpp.
const KeyLocator & ndn::SignatureInfo::getKeyLocator | ( | ) | const |
Get the KeyLocator
element.
Error | This SignatureInfo does not contain a KeyLocator element. |
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 231 of file signature-info.cpp.
optional< uint64_t > ndn::SignatureInfo::getSeqNum | ( | ) | const |
Get SignatureSeqNum.
nullopt | SignatureSeqNum is not set |
Definition at line 276 of file signature-info.cpp.
|
inlinenoexcept |
Get the SignatureType
.
Definition at line 114 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 253 of file signature-info.cpp.
security::ValidityPeriod ndn::SignatureInfo::getValidityPeriod | ( | ) | const |
Get the ValidityPeriod
element.
Error | This SignatureInfo does not contain a ValidityPeriod |
Definition at line 209 of file signature-info.cpp.
|
inlinenoexcept |
Check if KeyLocator
is present.
Definition at line 128 of file signature-info.hpp.
|
inlinenoexcept |
Check if this instance has cached wire encoding.
Definition at line 104 of file signature-info.hpp.
|
inlineexplicitnoexcept |
Determine whether SignatureInfo is valid.
Definition at line 66 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 324 of file signature-info.cpp.
SignatureInfo & ndn::SignatureInfo::setKeyLocator | ( | optional< KeyLocator > | keyLocator | ) |
Set or unset the KeyLocator
element.
Passing nullopt
will remove the KeyLocator
element.
Definition at line 199 of file signature-info.cpp.
SignatureInfo & ndn::SignatureInfo::setNonce | ( | optional< span< const uint8_t >> | nonce | ) |
Append or replace SignatureNonce.
Passing nullopt
will remove the SignatureNonce.
Definition at line 241 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 286 of file signature-info.cpp.
SignatureInfo & ndn::SignatureInfo::setSignatureType | ( | tlv::SignatureTypeValue | type | ) |
Set the 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 263 of file signature-info.cpp.
SignatureInfo & ndn::SignatureInfo::setValidityPeriod | ( | optional< security::ValidityPeriod > | validityPeriod | ) |
Append, replace, or remove the ValidityPeriod
element.
Passing nullopt
will remove the ValidityPeriod
element.
Definition at line 219 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 352 of file signature-info.cpp.
|
friend |
Definition at line 345 of file signature-info.cpp.