obu-firmware builds against vanetza-idf from microbu-esp32c5/external, but that tree was gitignored, so a clone of this repository could not build the firmware it ships. It is now committed here as ordinary files in its own folder, microbu-esp32c5/: the colleague's commit cf4b99f plus the V2X2MAP bridge's signature verification (--trust) used on the bench. Nothing is fetched from or pushed to the colleague's repository; this repository and its remotes carry everything. The folder's own .gitignore keeps build output, downloaded components and private key material out, as it did there; the committed file set is identical to that repository's tracked files. The ESP32-C5 is still flashed from obu-firmware/, which only takes vanetza-idf from microbu-esp32c5/, so the two stay separate folders. FLASHING.md says how to take a newer version of the colleague's tree (copy it over the folder, rebuild, test, commit).
48 lines
1.4 KiB
C++
48 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include "certificate.hpp"
|
|
#include "response_codes.hpp"
|
|
#include <vanetza/common/byte_buffer.hpp>
|
|
#include <boost/optional/optional.hpp>
|
|
|
|
namespace vanetza
|
|
{
|
|
namespace pki
|
|
{
|
|
|
|
class SecurityModule;
|
|
|
|
/**
|
|
* \brief Decoded view of an InnerEcResponse payload.
|
|
* \see TS 102 941 §6.2.3.2.2
|
|
*/
|
|
struct EnrolmentResponse
|
|
{
|
|
EnrolmentResponseCode code; // EA's responseCode; parsing succeeds for any value
|
|
ByteBuffer request_hash; // SHA-256 prefix of the matching request
|
|
boost::optional<Certificate> certificate; // new EC; present iff one was decoded — caller must still check `code == ok`
|
|
};
|
|
|
|
/**
|
|
* Parse a decrypted EnrolmentResponse per ETSI TS 102 941 §6.2.3.2.2.
|
|
*
|
|
* Verifies:
|
|
* - outer Ieee1609Dot2Data is signedData
|
|
* - signer = digest, matching HashedId8(ea_certificate)
|
|
* - tbsData.headerInfo.psid == aid::SCR
|
|
* - outer signature verifies against ea_certificate
|
|
* - inner EtsiTs102941Data.version == v1
|
|
* - inner content variant is enrolmentResponse
|
|
*
|
|
* For a non-ok responseCode the function returns normally and `code` holds it;
|
|
* `certificate` is populated iff the response actually contains one.
|
|
*
|
|
* \throws DecodingFailure on structural failure
|
|
* \throws VerificationFailure on signer-digest or signature mismatch
|
|
*/
|
|
EnrolmentResponse parse_enrolment_response(SecurityModule& security, const ByteBuffer& decrypted,
|
|
const Certificate& ea_certificate);
|
|
|
|
} // namespace pki
|
|
} // namespace vanetza
|