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, std::optional< KeyLocator > keyLocator=std::nullopt) | |
Create with the specified type and KeyLocator. More... | |
void | addCustomTlv (Block block) |
Append an arbitrary TLV element to this SignatureInfo. More... | |
std::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... | |
std::optional< std::vector< uint8_t > > | getNonce () const |
Get SignatureNonce. More... | |
std::optional< uint64_t > | getSeqNum () const |
Get SignatureSeqNum. More... | |
int32_t | getSignatureType () const noexcept |
Get the SignatureType . More... | |
std::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 (std::optional< KeyLocator > keyLocator) |
Set or unset the KeyLocator element. More... | |
SignatureInfo & | setNonce (std::optional< span< const uint8_t >> nonce) |
Append or replace SignatureNonce. More... | |
SignatureInfo & | setSeqNum (std::optional< uint64_t > seqNum) |
Append or replace SignatureSeqNum. More... | |
SignatureInfo & | setSignatureType (tlv::SignatureTypeValue type) |
Set the SignatureType . More... | |
SignatureInfo & | setTime (std::optional< time::system_clock::time_point > time=time::system_clock::now()) |
Append or replace SignatureTime. More... | |
SignatureInfo & | setValidityPeriod (std::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 33 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 39 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 301 of file signature-info.cpp.
std::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 291 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 183 of file signature-info.cpp.
std::optional< std::vector< uint8_t > > ndn::SignatureInfo::getNonce | ( | ) | const |
Get SignatureNonce.
nullopt | SignatureNonce is not set |
Definition at line 224 of file signature-info.cpp.
std::optional< uint64_t > ndn::SignatureInfo::getSeqNum | ( | ) | const |
Get SignatureSeqNum.
nullopt | SignatureSeqNum is not set |
Definition at line 269 of file signature-info.cpp.
|
inlinenoexcept |
Get the SignatureType
.
Definition at line 114 of file signature-info.hpp.
std::optional< time::system_clock::time_point > ndn::SignatureInfo::getTime | ( | ) | const |
Get SignatureTime.
nullopt | SignatureTime is not set |
Definition at line 246 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 202 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 317 of file signature-info.cpp.
SignatureInfo & ndn::SignatureInfo::setKeyLocator | ( | std::optional< KeyLocator > | keyLocator | ) |
Set or unset the KeyLocator
element.
Passing nullopt
will remove the KeyLocator
element.
Definition at line 192 of file signature-info.cpp.
SignatureInfo & ndn::SignatureInfo::setNonce | ( | std::optional< span< const uint8_t >> | nonce | ) |
Append or replace SignatureNonce.
Passing nullopt
will remove the SignatureNonce.
Definition at line 234 of file signature-info.cpp.
SignatureInfo & ndn::SignatureInfo::setSeqNum | ( | std::optional< uint64_t > | seqNum | ) |
Append or replace SignatureSeqNum.
Passing nullopt
will remove the SignatureSeqNum.
Definition at line 279 of file signature-info.cpp.
SignatureInfo & ndn::SignatureInfo::setSignatureType | ( | tlv::SignatureTypeValue | type | ) |
Set the SignatureType
.
Definition at line 173 of file signature-info.cpp.
SignatureInfo & ndn::SignatureInfo::setTime | ( | std::optional< time::system_clock::time_point > | time = time::system_clock::now() | ) |
Append or replace SignatureTime.
Passing nullopt
will remove the SignatureTime.
Definition at line 256 of file signature-info.cpp.
SignatureInfo & ndn::SignatureInfo::setValidityPeriod | ( | std::optional< security::ValidityPeriod > | validityPeriod | ) |
Append, replace, or remove the ValidityPeriod
element.
Passing nullopt
will remove the ValidityPeriod
element.
Definition at line 212 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 110 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 46 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 94 of file signature-info.cpp.
|
friend |
Definition at line 345 of file signature-info.cpp.
|
friend |
Definition at line 338 of file signature-info.cpp.