33 NDN_THROW(std::invalid_argument(
"No signature elements specified"));
37 std::vector<uint8_t> nonce(8);
43 info.setTime(getFreshTimestamp());
47 info.setSeqNum(++m_lastUsedSeqNum);
52 m_keyChain.
sign(interest, params);
65 m_keyChain.
sign(interest, params);
70 InterestSigner::getFreshTimestamp()
73 if (time::duration_cast<time::milliseconds>(timestamp - m_lastUsedTimestamp) > 0_ms) {
74 m_lastUsedTimestamp = timestamp;
77 m_lastUsedTimestamp = m_lastUsedTimestamp + 1_ms;
78 timestamp = m_lastUsedTimestamp;
Represents an Interest packet.
Interest & setName(const Name &name)
Set the Interest name.
Represents an absolute name.
Name & append(const Component &component)
Append a name component.
Represents a SignatureInfo or InterestSignatureInfo TLV element.
static Component fromNumber(uint64_t number, uint32_t type=tlv::GenericNameComponent)
Create a component encoded as NonNegativeInteger.
Interest makeCommandInterest(Name name, const SigningInfo ¶ms=SigningInfo())
Creates and signs a command Interest.
void makeSignedInterest(Interest &interest, SigningInfo params=SigningInfo(), uint32_t signingFlags=WantNonce|WantTime)
Signs an Interest (following Packet Specification v0.3 or newer)
void sign(Data &data, const SigningInfo ¶ms=SigningInfo())
Sign a Data packet according to the supplied signing information.
Signing parameters passed to KeyChain.
SigningInfo & setSignedInterestFormat(SignedInterestFormat signedInterestFormat)
Set the signed Interest format.
SigningInfo & setSignatureInfo(const SignatureInfo &signatureInfo)
Set a semi-prepared SignatureInfo.
const SignatureInfo & getSignatureInfo() const
Get a semi-prepared SignatureInfo.
static time_point now() noexcept
::boost::chrono::time_point< system_clock > time_point
void generateSecureBytes(span< uint8_t > buf)
Fill buffer with cryptographically secure random bytes.
uint64_t generateWord64()
Generate a non-cryptographically-secure random integer in the range [0, 2^64).
Contains the ndn-cxx security framework.
@ V03
Sign Interest using Packet Specification v0.3 semantics.
constexpr Duration toUnixTimestamp(const system_clock::time_point &tp)
Convert system_clock::time_point to UNIX timestamp.
::boost::chrono::milliseconds milliseconds