22 #ifndef NDN_CXX_SIGNATURE_INFO_HPP
23 #define NDN_CXX_SIGNATURE_INFO_HPP
42 enum class Type : uint32_t {
66 operator bool() const noexcept
79 template<encoding::Tag TAG>
130 return m_keyLocator.has_value();
166 std::optional<std::vector<uint8_t>>
176 setNonce(std::optional<span<const uint8_t>> nonce);
181 std::optional<time::system_clock::time_point>
196 std::optional<uint64_t>
206 setSeqNum(std::optional<uint64_t> seqNum);
229 std::vector<Block>::const_iterator
230 findOtherTlv(uint32_t type)
const;
234 std::optional<KeyLocator> m_keyLocator;
235 std::vector<Block> m_otherTlvs;
237 mutable Block m_wire;
247 extern template size_t
250 extern template size_t
260 return !(lhs == rhs);
Represents a TLV element of the NDN packet format.
bool hasWire() const noexcept
Check if the Block contains a fully encoded wire representation.
Represents a Data packet.
Represents an Interest packet.
Represents a SignatureInfo or InterestSignatureInfo TLV element.
size_t wireEncode(EncodingImpl< TAG > &encoder, Type type=Type::Data) const
Fast encoding or block size estimation.
SignatureInfo & setSignatureType(tlv::SignatureTypeValue type)
Set the SignatureType.
SignatureInfo & setSeqNum(std::optional< uint64_t > seqNum)
Append or replace SignatureSeqNum.
std::optional< uint64_t > getSeqNum() const
Get SignatureSeqNum.
std::optional< std::vector< uint8_t > > getNonce() const
Get SignatureNonce.
void addCustomTlv(Block block)
Append an arbitrary TLV element to this SignatureInfo.
security::ValidityPeriod getValidityPeriod() const
Get the ValidityPeriod element.
int32_t getSignatureType() const noexcept
Get the SignatureType.
SignatureInfo & setTime(std::optional< time::system_clock::time_point > time=time::system_clock::now())
Append or replace SignatureTime.
SignatureInfo & setValidityPeriod(std::optional< security::ValidityPeriod > validityPeriod)
Append, replace, or remove the ValidityPeriod element.
bool hasKeyLocator() const noexcept
Check if KeyLocator is present.
bool hasWire() const noexcept
Check if this instance has cached wire encoding.
void removeCustomTlv(uint32_t type)
Remove all arbitrary TLV elements with the specified TLV-TYPE from this SignatureInfo.
void wireDecode(const Block &wire, Type type=Type::Data)
Decode from wire format.
std::optional< Block > getCustomTlv(uint32_t type) const
Get first custom TLV element with the specified TLV-TYPE.
std::optional< time::system_clock::time_point > getTime() const
Get SignatureTime.
SignatureInfo & setNonce(std::optional< span< const uint8_t >> nonce)
Append or replace SignatureNonce.
friend std::ostream & operator<<(std::ostream &os, const SignatureInfo &info)
SignatureInfo & setKeyLocator(std::optional< KeyLocator > keyLocator)
Set or unset the KeyLocator element.
friend bool operator==(const SignatureInfo &lhs, const SignatureInfo &rhs)
const KeyLocator & getKeyLocator() const
Get the KeyLocator element.
Represents a ValidityPeriod TLV element.
static time_point now() noexcept
Represents an error in TLV encoding or decoding.
Error(const char *expectedType, uint32_t actualType)
EncodingImpl< EstimatorTag > EncodingEstimator
EncodingImpl< EncoderTag > EncodingBuffer
SignatureTypeValue
SignatureType values.
bool operator!=(const Data &lhs, const Data &rhs)
bool operator==(const Data &lhs, const Data &rhs)
std::ostream & operator<<(std::ostream &os, const Data &data)