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 optional<std::vector<uint8_t>>
176 setNonce(optional<span<const uint8_t>> nonce);
181 optional<time::system_clock::time_point>
229 std::vector<Block>::const_iterator
230 findOtherTlv(uint32_t type)
const;
234 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 & setValidityPeriod(optional< security::ValidityPeriod > validityPeriod)
Append, replace, or remove the ValidityPeriod element.
SignatureInfo & setNonce(optional< span< const uint8_t >> nonce)
Append or replace SignatureNonce.
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.
optional< uint64_t > getSeqNum() const
Get SignatureSeqNum.
int32_t getSignatureType() const noexcept
Get the SignatureType.
bool hasKeyLocator() const noexcept
Check if KeyLocator is present.
bool hasWire() const noexcept
Check if this instance has cached wire encoding.
optional< Block > getCustomTlv(uint32_t type) const
Get first custom TLV element with the specified TLV-TYPE.
void removeCustomTlv(uint32_t type)
Remove all arbitrary TLV elements with the specified TLV-TYPE from this SignatureInfo.
optional< time::system_clock::time_point > getTime() const
Get SignatureTime.
void wireDecode(const Block &wire, Type type=Type::Data)
Decode from wire format.
SignatureInfo & setTime(optional< time::system_clock::time_point > time=time::system_clock::now())
Append or replace SignatureTime.
SignatureInfo & setSeqNum(optional< uint64_t > seqNum)
Append or replace SignatureSeqNum.
friend std::ostream & operator<<(std::ostream &os, const SignatureInfo &info)
friend bool operator==(const SignatureInfo &lhs, const SignatureInfo &rhs)
const KeyLocator & getKeyLocator() const
Get the KeyLocator element.
SignatureInfo & setKeyLocator(optional< KeyLocator > keyLocator)
Set or unset 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)