Helper class to create signed Interests. More...
#include <interest-signer.hpp>
Public Types | |
enum | SigningFlags : uint32_t { WantNonce = 1 << 0, WantTime = 1 << 1, WantSeqNum = 1 << 2 } |
Flags to indicate which elements to include in Interest signatures created with makeSignedInterest. More... | |
Public Member Functions | |
InterestSigner (KeyChain &keyChain) | |
void | makeSignedInterest (Interest &interest, SigningInfo params=SigningInfo(), uint32_t signingFlags=WantNonce|WantTime) |
Signs an Interest (following Packet Specification v0.3 or newer) More... | |
Interest | makeCommandInterest (Name name, const SigningInfo ¶ms=SigningInfo()) |
Creates and signs a command Interest. More... | |
Helper class to create signed Interests.
The signer generates signature elements for an Interest and signs it with the KeyChain.
Definition at line 35 of file interest-signer.hpp.
enum ndn::security::InterestSigner::SigningFlags : uint32_t |
Flags to indicate which elements to include in Interest signatures created with makeSignedInterest.
Enumerator | |
---|---|
WantNonce | |
WantTime | |
WantSeqNum |
Definition at line 43 of file interest-signer.hpp.
|
explicit |
Definition at line 28 of file interest-signer.cpp.
void ndn::security::InterestSigner::makeSignedInterest | ( | Interest & | interest, |
SigningInfo | params = SigningInfo() , |
||
uint32_t | signingFlags = WantNonce | WantTime |
||
) |
Signs an Interest (following Packet Specification v0.3 or newer)
interest | Interest to sign |
params | SigningInfo that provides parameters on how to sign the Interest. |
signingFlags | Indicates which elements to include in the signature. At least one element must be specified for inclusion. |
std::invalid_argument | No signature elements were specified for inclusion. |
Definition at line 35 of file interest-signer.cpp.
References ndn::random::generateSecureBytes(), ndn::security::SigningInfo::getSignatureInfo(), info, NDN_THROW, ndn::SignatureInfo::setNonce(), ndn::SignatureInfo::setSeqNum(), ndn::security::SigningInfo::setSignatureInfo(), ndn::security::SigningInfo::setSignedInterestFormat(), ndn::SignatureInfo::setTime(), ndn::security::V03, WantNonce, WantSeqNum, and WantTime.
Interest ndn::security::InterestSigner::makeCommandInterest | ( | Name | name, |
const SigningInfo & | params = SigningInfo() |
||
) |
Creates and signs a command Interest.
These can be created with makeSignedInterest.
This generates a nonce and timestamp for the command Interest.
Definition at line 63 of file interest-signer.cpp.
References ndn::Name::append(), ndn::name::Component::fromNumber(), ndn::random::generateWord64(), ndn::time::system_clock::now(), ndn::Interest::setName(), and ndn::time::toUnixTimestamp().
Referenced by ndn::nfd::Controller::~Controller().