Vanetza
Loading...
Searching...
No Matches
revocation_lookup.hpp
1#pragma once
2#include <vanetza/security/hashed_id.hpp>
3#include <unordered_map>
4#include <unordered_set>
5
6namespace vanetza
7{
8namespace security
9{
10namespace v3
11{
12
13/**
14 * Lookup for HashedId8-style certificate revocation.
15 *
16 * Backs the chain-walk performed by DefaultCertificateValidator: for every
17 * non-root certificate the validator encounters while walking up the chain,
18 * it asks whether that certificate has been revoked by a CRL signed by its
19 * issuer.
20 *
21 * Linkage-value CRLs (TS 102 941 ToBeSignedLinkageValueCrl) are out of scope:
22 * the European C-ITS Certificate Policy does not revoke ATs, and revoking CAs
23 * only ever needs HashedId8 entries.
24 */
26{
27public:
28 virtual ~RevocationLookup() = default;
29
30 /**
31 * \param issuer HashedId8 of the CA whose CRL is consulted
32 * \param cert HashedId8 of the certificate being checked
33 * \return true iff the CRL signed by \p issuer lists \p cert as revoked
34 */
35 virtual bool is_revoked(const HashedId8& issuer, const HashedId8& cert) const = 0;
36};
37
38/**
39 * In-memory RevocationLookup, indexed by issuer HashedId8.
40 */
42{
43public:
44 void revoke(const HashedId8& issuer, const HashedId8& cert);
45 void clear(const HashedId8& issuer);
46
47 bool is_revoked(const HashedId8& issuer, const HashedId8& cert) const override;
48
49private:
50 std::unordered_map<HashedId8, std::unordered_set<HashedId8>> m_revoked;
51};
52
53} // namespace v3
54} // namespace security
55} // namespace vanetza
virtual const PositionFix & position_fix()=0
virtual Clock::time_point now() const =0
bool valid_at_timepoint(const Clock::time_point &time_point) const
StartAndEndValidity get_start_and_end_validity() const
bool is_allowed_to_issue(ItsAid aid) const
bool valid_for_application(ItsAid aid) const
boost::optional< HashedId8 > calculate_digest() const
bool valid_at_location(const PositionFix &location, const LocationChecker *lc) const
bool region_is_within(const CertificateView &issuer) const
boost::optional< std::uint8_t > assurance_level() const
boost::optional< HashedId8 > issuer_digest() const
Verdict valid_for_signing(const CertificateView &, ItsAid) override
virtual const Certificate * find_issuer(const HashedId8 &digest) const =0
virtual bool is_revoked(const HashedId8 &issuer, const HashedId8 &cert) const =0
bool is_revoked(const HashedId8 &issuer, const HashedId8 &cert) const override