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
certificate-fetcher.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#include "
certificate-fetcher.hpp
"
23
#include "
util/logger.hpp
"
24
25
namespace
ndn
{
26
namespace
security
{
27
namespace
v2 {
28
29
NDN_LOG_INIT
(
ndn
.
security
.
v2
.
CertificateFetcher
);
30
31
#define NDN_LOG_DEBUG_DEPTH(x) NDN_LOG_DEBUG(std::string(state->getDepth() + 1, '>') << " " << x)
32
33
CertificateFetcher::CertificateFetcher
()
34
: m_certStorage(nullptr)
35
{
36
}
37
38
CertificateFetcher::~CertificateFetcher
() =
default
;
39
40
void
41
CertificateFetcher::setCertificateStorage
(
CertificateStorage
& certStorage)
42
{
43
m_certStorage
= &certStorage;
44
}
45
46
void
47
CertificateFetcher::fetch
(
const
shared_ptr<CertificateRequest>& certRequest,
48
const
shared_ptr<ValidationState>& state,
49
const
ValidationContinuation
& continueValidation)
50
{
51
BOOST_ASSERT(
m_certStorage
!=
nullptr
);
52
auto
cert =
m_certStorage
->
getUnverifiedCertCache
().
find
(certRequest->m_interest);
53
if
(cert !=
nullptr
) {
54
NDN_LOG_DEBUG_DEPTH
(
"Found certificate in **un**verified key cache "
<< cert->getName());
55
continueValidation(*cert, state);
56
return
;
57
}
58
doFetch(certRequest, state,
59
[continueValidation,
this
] (
const
Certificate
& cert,
const
shared_ptr<ValidationState>& state) {
60
m_certStorage
->
cacheUnverifiedCert
(
Certificate
(cert));
61
continueValidation(cert, state);
62
});
63
}
64
65
}
// namespace v2
66
}
// namespace security
67
}
// namespace ndn
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::security::v2::Certificate
The certificate following the certificate format naming convention.
Definition:
certificate.hpp:81
ndn::security::v2::CertificateFetcher
Interface used by the validator to fetch missing certificates.
Definition:
certificate-fetcher.hpp:39
ndn::security::v2
Definition:
command-authenticator.hpp:34
ndn::security::v2::CertificateFetcher::m_certStorage
CertificateStorage * m_certStorage
Definition:
certificate-fetcher.hpp:84
ndn::security::v2::CertificateStorage::cacheUnverifiedCert
void cacheUnverifiedCert(Certificate &&cert)
Cache unverified certificate for a period of time (5 minutes)
Definition:
certificate-storage.cpp:86
ndn::security::v2::CertificateFetcher::ValidationContinuation
std::function< void(const Certificate &cert, const shared_ptr< ValidationState > &state)> ValidationContinuation
Definition:
certificate-fetcher.hpp:43
ndn::security::v2::CertificateCache::find
const Certificate * find(const Name &certPrefix) const
Get certificate given key name.
Definition:
certificate-cache.cpp:68
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_LOG_INIT
#define NDN_LOG_INIT(name)
declare a log module
Definition:
logger.hpp:32
ndn::security::v2::CertificateFetcher::CertificateFetcher
CertificateFetcher()
Definition:
certificate-fetcher.cpp:33
ndn::security::v2::CertificateStorage::getUnverifiedCertCache
const CertificateCache & getUnverifiedCertCache() const
Definition:
certificate-storage.cpp:104
ndn::security::v2::CertificateStorage
Storage for trusted anchors, verified certificate cache, and unverified certificate cache...
Definition:
certificate-storage.hpp:36
ndn::security::v2::CertificateFetcher::fetch
void fetch(const shared_ptr< CertificateRequest > &certRequest, const shared_ptr< ValidationState > &state, const ValidationContinuation &continueValidation)
Asynchronously fetch certificate.
Definition:
certificate-fetcher.cpp:47
ndn::security
Definition:
dummy-keychain.cpp:28
NDN_LOG_DEBUG_DEPTH
#define NDN_LOG_DEBUG_DEPTH(x)
Definition:
certificate-fetcher.cpp:31
ndn::security::v2::CertificateFetcher::~CertificateFetcher
virtual ~CertificateFetcher()
logger.hpp
certificate-fetcher.hpp
ndn::security::v2::CertificateFetcher::setCertificateStorage
virtual void setCertificateStorage(CertificateStorage &certStorage)
Assign certificate storage to check known certificate and to cache unverified ones.
Definition:
certificate-fetcher.cpp:41
ndnSIM
ndn-cxx
src
security
v2
certificate-fetcher.cpp
Generated on Thu Nov 2 2017 03:30:28 for ndnSIM by
1.8.11