Vanetza
Loading...
Searching...
No Matches
certificate_cache.hpp
1
#pragma once
2
#include <vanetza/security/hashed_id.hpp>
3
#include <vanetza/security/v3/certificate.hpp>
4
#include <unordered_map>
5
6
namespace
vanetza
7
{
8
namespace
security
9
{
10
namespace
v3
11
{
12
13
/**
14
* CertificateCache stores validated v1.3.1 certificates for later lookup.
15
* Required for checking messages' signatures containing only a certificate digest.
16
*/
17
class
CertificateCache
18
{
19
public
:
20
/**
21
* Lookup certificate based on given digest
22
* \param digest certificate digest
23
* \return certificate matching digest
24
*/
25
const
Certificate
*
lookup
(
const
HashedId8& digest)
const
;
26
27
/**
28
* Store a (pre-validated) certificate in cache
29
* \param cert certificate
30
*/
31
void
store
(
const
Certificate
& cert);
32
33
size_t
size()
const
{
return
m_storage.size(); }
34
35
private
:
36
// TODO add bounded capacity and automatic removal of expired certificates
37
std::unordered_map<HashedId8, Certificate> m_storage;
38
};
39
40
}
// namespace v3
41
}
// namespace security
42
}
// namespace vanetza
vanetza::security::v3::CertificateCache
Definition:
certificate_cache.hpp:18
vanetza::security::v3::CertificateCache::lookup
const Certificate * lookup(const HashedId8 &digest) const
Definition:
certificate_cache.cpp:11
vanetza::security::v3::CertificateCache::store
void store(const Certificate &cert)
Definition:
certificate_cache.cpp:21
vanetza::security::v3::Certificate
Definition:
certificate.hpp:17
vanetza
security
v3
certificate_cache.hpp
Generated on Thu Nov 30 2023 12:03:35 for Vanetza by
1.9.6