29 : m_keyChain(keyChain)
30 , m_lastUsedSeqNum(-1)
40 NDN_THROW(std::invalid_argument(
"No signature elements specified"));
44 std::vector<uint8_t> nonce(8);
50 info.
setTime(getFreshTimestamp());
59 m_keyChain.sign(interest, params);
72 m_keyChain.sign(interest, params);
77 InterestSigner::getFreshTimestamp()
80 if (time::duration_cast<time::milliseconds>(timestamp - m_lastUsedTimestamp) > 0_ms) {
81 m_lastUsedTimestamp = timestamp;
84 m_lastUsedTimestamp = m_lastUsedTimestamp + 1_ms;
85 timestamp = m_lastUsedTimestamp;
SignatureInfo & setSeqNum(optional< uint64_t > seqNum)
Append or replace SignatureSeqNum.
Sign Interest using Packet Specification v0.3 semantics.
Copyright (c) 2011-2015 Regents of the University of California.
Represents a SignatureInfo or InterestSignatureInfo TLV element.
const SignatureInfo & getSignatureInfo() const
Interest makeCommandInterest(Name name, const SigningInfo ¶ms=SigningInfo())
Creates and signs a command Interest.
InterestSigner(KeyChain &keyChain)
Represents an Interest packet.
static time_point now() noexcept
milliseconds toUnixTimestamp(const system_clock::time_point &point)
Convert system_clock::time_point to UNIX timestamp.
Name & append(const Component &component)
Append a component.
void generateSecureBytes(span< uint8_t > buf)
Fill buffer with cryptographically secure random bytes.
Signing parameters passed to KeyChain.
SignatureInfo & setTime(optional< time::system_clock::time_point > time=time::system_clock::now())
Append or replace SignatureTime.
Represents an absolute name.
SignatureInfo & setNonce(optional< span< const uint8_t >> nonce)
Append or replace SignatureNonce.
SigningInfo & setSignatureInfo(const SignatureInfo &signatureInfo)
Set a semi-prepared SignatureInfo.
uint64_t generateWord64()
Generate a non-cryptographically-secure random integer in the range [0, 2^64)
static Component fromNumber(uint64_t number, uint32_t type=tlv::GenericNameComponent)
Create a component encoded as NonNegativeInteger.
void makeSignedInterest(Interest &interest, SigningInfo params=SigningInfo(), uint32_t signingFlags=WantNonce|WantTime)
Signs an Interest (following Packet Specification v0.3 or newer)
SigningInfo & setSignedInterestFormat(SignedInterestFormat signedInterestFormat)
Set signed Interest format.
boost::chrono::milliseconds milliseconds
Interest & setName(const Name &name)
Set the Interest's name.