NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
command-interest-signer.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#include "
command-interest-signer.hpp
"
23
#include "../util/random.hpp"
24
25
namespace
ndn
{
26
namespace
security
{
27
28
CommandInterestPreparer::CommandInterestPreparer
()
29
: m_lastUsedTimestamp(0)
30
{
31
}
32
33
Name
34
CommandInterestPreparer::prepareCommandInterestName
(
Name
name
)
35
{
36
time::milliseconds
timestamp =
time::toUnixTimestamp
(
time::system_clock::now
());
37
if
(timestamp <= m_lastUsedTimestamp) {
38
timestamp = m_lastUsedTimestamp +
time::milliseconds
(1);
39
}
40
m_lastUsedTimestamp = timestamp;
41
42
name
43
.
append
(
name::Component::fromNumber
(timestamp.count()))
44
.
append
(
name::Component::fromNumber
(
random::generateWord64
()))
// nonce
45
;
46
47
return
name;
48
}
49
50
CommandInterestSigner::CommandInterestSigner
(
KeyChain
& keyChain)
51
: m_keyChain(keyChain)
52
{
53
}
54
55
Interest
56
CommandInterestSigner::makeCommandInterest
(
const
Name
&
name
,
const
SigningInfo
& params)
57
{
58
Interest
commandInterest(
prepareCommandInterestName
(name));
59
m_keyChain.sign(commandInterest, params);
60
return
commandInterest;
61
}
62
63
}
// namespace security
64
}
// namespace ndn
ndn::name::Component::fromNumber
static Component fromNumber(uint64_t number)
Create a component encoded as nonNegativeInteger.
Definition:
name-component.cpp:291
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
command-interest-signer.hpp
websocketpp::lib::asio::milliseconds
boost::posix_time::time_duration milliseconds(long duration)
Definition:
asio.hpp:117
ndn::Interest
represents an Interest packet
Definition:
interest.hpp:42
ndn::security::CommandInterestPreparer::prepareCommandInterestName
Name prepareCommandInterestName(Name name)
Prepare name of the CommandInterest.
Definition:
command-interest-signer.cpp:34
ndn::time::system_clock::now
static time_point now() noexcept
Definition:
time.cpp:46
ndn::Name::append
Name & append(const Component &component)
Append a component.
Definition:
name.hpp:256
ndn::security::SigningInfo
Signing parameters passed to KeyChain.
Definition:
signing-info.hpp:40
ndn::security::CommandInterestPreparer::CommandInterestPreparer
CommandInterestPreparer()
Definition:
command-interest-signer.cpp:28
websocketpp::transport::asio::socket::error::security
Catch-all error for security policy errors that don't fit in other categories.
Definition:
base.hpp:79
ndn::security::CommandInterestSigner::CommandInterestSigner
CommandInterestSigner(KeyChain &keyChain)
Definition:
command-interest-signer.cpp:50
ndn::security::CommandInterestSigner::makeCommandInterest
Interest makeCommandInterest(const Name &name, const SigningInfo ¶ms=KeyChain::getDefaultSigningInfo())
Create CommandInterest.
Definition:
command-interest-signer.cpp:56
ndn::Name
Represents an absolute name.
Definition:
name.hpp:42
ndn::random::generateWord64
uint64_t generateWord64()
Generate a non-cryptographically-secure random integer in the range [0, 2^64)
Definition:
random.cpp:70
ndn::time::toUnixTimestamp
milliseconds toUnixTimestamp(const system_clock::TimePoint &point)
Convert system_clock::TimePoint to UNIX timestamp.
Definition:
time.cpp:119
ndn::security::v2::KeyChain
ndn security v2 KeyChain
Definition:
key-chain.cpp:76
ndn::name
Definition:
name-component.cpp:37
ndnSIM
ndn-cxx
src
security
command-interest-signer.cpp
Generated on Thu Nov 2 2017 03:30:28 for ndnSIM by
1.8.11