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
5namespace vanetza
6{
7
8// forward declarations
10class Runtime;
11
12namespace security
13{
14namespace v3
15{
16
17// forward declarations
18class Certificate;
20class CertificateView;
21
23{
24public:
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
47{
48public:
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
59private:
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
71{
72public:
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
virtual Verdict valid_for_signing(const CertificateView &certificate, ItsAid app)=0
Verdict valid_for_signing(const CertificateView &, ItsAid) override
Verdict valid_for_signing(const CertificateView &, ItsAid) override