Vanetza
Loading...
Searching...
No Matches
certificate_validator.hpp
1
#pragma once
2
#include <vanetza/common/its_aid.hpp>
3
#include <vanetza/security/v3/location_checker.hpp>
4
5
namespace
vanetza
6
{
7
8
// forward declarations
9
class
PositionProvider
;
10
class
Runtime
;
11
12
namespace
security
13
{
14
namespace
v3
15
{
16
17
// forward declarations
18
class
Certificate
;
19
class
CertificateCache
;
20
class
CertificateView
;
21
22
class
CertificateValidator
23
{
24
public
:
25
enum class
Verdict
26
{
27
Unknown,
28
Valid,
29
Expired,
30
Revoked,
31
OutsideRegion,
32
InsufficientPermission,
33
Misconfiguration,
34
};
35
36
/**
37
* Check if a certificate can be used for signing a message
38
* \param certificate pre-validated AT certificate
39
* \param app ITS-AID of the message to be signed
40
*/
41
virtual
Verdict
valid_for_signing
(
const
CertificateView
& certificate, ItsAid app) = 0;
42
43
virtual
~CertificateValidator
() =
default
;
44
};
45
46
class
DefaultCertificateValidator
:
public
CertificateValidator
47
{
48
public
:
49
Verdict
valid_for_signing
(
const
CertificateView
&, ItsAid)
override
;
50
51
void
use_runtime(
const
Runtime
* runtime);
52
void
use_position_provider(
PositionProvider
* provider);
53
void
use_certificate_cache(
const
CertificateCache
* cache);
54
void
use_location_checker(
const
LocationChecker
* checker);
55
56
void
disable_time_checks(
bool
flag);
57
void
disable_location_checks(
bool
flag);
58
59
private
:
60
const
Certificate
* find_issuer_certificate(
const
CertificateView
& certificate)
const
;
61
62
const
Runtime
* m_runtime =
nullptr
;
63
PositionProvider
* m_position_provider =
nullptr
;
64
const
CertificateCache
* m_certificate_cache =
nullptr
;
65
const
LocationChecker
* m_location_checker =
nullptr
;
66
bool
m_disable_time_checks =
false
;
67
bool
m_disable_location_checks =
false
;
68
};
69
70
class
NullCertificateValidator
:
public
CertificateValidator
71
{
72
public
:
73
Verdict
valid_for_signing
(
const
CertificateView
&, ItsAid)
override
74
{
75
return
Verdict::Valid;
76
}
77
};
78
79
}
// namespace v3
80
}
// namespace security
81
}
// namespace vanetza
vanetza::PositionProvider
Definition
position_provider.hpp:16
vanetza::Runtime
Definition
runtime.hpp:16
vanetza::security::v3::CertificateCache
Definition
certificate_cache.hpp:19
vanetza::security::v3::CertificateValidator
Definition
certificate_validator.hpp:23
vanetza::security::v3::CertificateValidator::valid_for_signing
virtual Verdict valid_for_signing(const CertificateView &certificate, ItsAid app)=0
vanetza::security::v3::CertificateView
Definition
certificate.hpp:35
vanetza::security::v3::DefaultCertificateValidator
Definition
certificate_validator.hpp:47
vanetza::security::v3::DefaultCertificateValidator::valid_for_signing
Verdict valid_for_signing(const CertificateView &, ItsAid) override
Definition
certificate_validator.cpp:15
vanetza::security::v3::LocationChecker
Definition
location_checker.hpp:22
vanetza::security::v3::NullCertificateValidator
Definition
certificate_validator.hpp:71
vanetza::security::v3::NullCertificateValidator::valid_for_signing
Verdict valid_for_signing(const CertificateView &, ItsAid) override
Definition
certificate_validator.hpp:73
vanetza::security::v3::Certificate
Definition
certificate.hpp:134
vanetza
security
v3
certificate_validator.hpp
Generated on
for Vanetza by
1.14.0