Files
MicrOBU/obu-firmware/external/vanetza-idf/vanetza/security/verify_service.hpp
T
Ashin Walpola d107534eb2 Keep vanetza-idf in obu-firmware, so a plain clone builds the firmware
obu-firmware builds against the vanetza-idf C-ITS library, which until now
came from the colleague's microbu-esp32c5 tree beside the repository and was
not tracked here, so a clone of this repository could not build the firmware
it ships. The library alone is now part of obu-firmware, as
obu-firmware/external/vanetza-idf: their external/vanetza-idf at commit
cf4b99f, unchanged (9775 files; see its PROVENANCE.md). CMake takes it from
there by default; -DVANETZA_IDF_DIR still points the build elsewhere.

The rest of the colleague's tree (their own VAM firmware, PKI tooling,
station-link Python tools, the V2X2MAP bridge) stays out of this repository
and gitignored; nothing is pushed to their repository. NOTES.md, docs/06,
TODO.md and the pcap verifier's usage line point at the new location.
2026-09-24 10:56:05 +02:00

99 lines
2.5 KiB
C++

#ifndef VERIFY_SERVICE_HPP_BR4ISDBH
#define VERIFY_SERVICE_HPP_BR4ISDBH
#include <boost/optional.hpp>
#include <vanetza/common/its_aid.hpp>
#include <vanetza/security/certificate_validity.hpp>
#include <vanetza/security/hashed_id.hpp>
#include <vanetza/security/secured_message.hpp>
namespace vanetza
{
namespace security
{
/**
* SN-VERIFY.confirm report codes
*
* "Configuration_Problem" is not found in TS 103 723-8 V1.1.1 but indicates a
* problem with the verification subsystem itself, e.g. a programming error.
*
* \see TS 102 723-8 v1.1.1 table 5
*/
enum class VerificationReport
{
Success,
False_Signature,
Invalid_Certificate,
Revoked_Certificate,
Inconsistent_Chain,
Invalid_Timestamp,
Duplicate_Message,
Invalid_Mobility_Data,
Unsigned_Message,
Signer_Certificate_Not_Found,
Unsupported_Signer_Identifier_Type,
Incompatible_Protocol,
Configuration_Problem,
};
// mandatory parameters of SN-VERIFY.request (TS 102 723-8 V1.1.1)
struct VerifyRequest
{
VerifyRequest(SecuredMessageView msg) : secured_message(msg) {}
SecuredMessageView secured_message; /*< contains security header and payload */
};
// parameters of SN-VERIFY.confirm (TS 102 723-8 V1.1.1)
struct VerifyConfirm
{
VerificationReport report; // mandatory
ItsAid its_aid; // mandatory
ByteBuffer permissions; // mandatory
CertificateValidity certificate_validity; // non-standard extension
boost::optional<HashedId8> certificate_id; // optional
};
/**
* Equivalent of SN-VERIFY service in TS 102 723-8 V1.1.1
*/
class VerifyService
{
public:
virtual ~VerifyService() = default;
virtual VerifyConfirm verify(const VerifyRequest&) = 0;
};
// forward declaration
namespace v3 { class CertificateCache; }
/**
* Get insecure dummy verify service without any checks
*/
class DummyVerifyService : public VerifyService
{
public:
/**
* \param report predefined confirm report result
* \param validity predefined certificate validity result
*/
DummyVerifyService(VerificationReport report, CertificateValidity validity);
VerifyConfirm verify(const VerifyRequest&) override;
/**
* \brief register certificate cache for optional permission lookup
* \param cache certificate cache
*/
void use_certificate_cache(v3::CertificateCache* cache);
private:
VerificationReport m_report;
CertificateValidity m_validity;
v3::CertificateCache* m_cert_cache = nullptr;
};
} // namespace security
} // namespace vanetza
#endif /* VERIFY_SERVICE_HPP_BR4ISDBH */