Vanetza
 
Loading...
Searching...
No Matches
certificate_cache.cpp
1#include <vanetza/security/v3/certificate_cache.hpp>
2#include <boost/optional/optional.hpp>
3
4namespace vanetza
5{
6namespace security
7{
8namespace v3
9{
10
11const Certificate* CertificateCache::lookup(const HashedId8& digest) const
12{
13 auto found = m_storage.find(digest);
14 if (found != m_storage.end()) {
15 return &found->second;
16 } else {
17 return nullptr;
18 }
19}
20
22{
23 auto maybe_hash = calculate_hash(*cert.content());
24 if (maybe_hash) {
25 m_storage[*maybe_hash] = cert;
26 }
27}
28
29} // namespace v3
30} // namespace security
31} // namespace vanetza
const Certificate * lookup(const HashedId8 &digest) const
void store(const Certificate &cert)