Files
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

55 lines
2.0 KiB
C++

#pragma once
#include "keys.hpp"
#include <vanetza/common/byte_buffer.hpp>
#include <vanetza/security/hash_algorithm.hpp>
#include <string>
namespace vanetza
{
namespace pki
{
class Certificate;
class EncryptedData;
class SecurityModule;
using security::HashAlgorithm;
/**
* \brief Parameters for an InnerEcRequest / outer EtsiTs103097Data-Signed enrolment message.
* \see TS 102 941 §6.2.3.2
*/
struct EnrolmentRequestParameters
{
std::string its_id; // canonical id (initial) or current EC HashedId8 (re-enrolment)
PublicKey verification_key; // to be certified; private key in SecurityModule for POP signature
PublicKey outer_signer_key; // signs outer Data-Signed; canonical key (initial) or current EC verification key (re-enrolment)
HashAlgorithm hash_algo = HashAlgorithm::SHA256; // POP and outer signatures
const Certificate* outer_signer_certificate = nullptr; // null → signer=self; non-null → signer=digest of this cert
};
/**
* \brief Build the signed (but not yet encrypted) enrolment request payload.
*
* Layered signatures: outer EtsiTs103097Data-Signed (signed with outer_signer_key;
* signer=self for initial enrolment, digest(outer_signer_certificate) for re-keying)
* wraps EtsiTs102941Data{enrolmentRequest=InnerEcRequestSignedForPop}, which is
* the OER-encoded InnerEcRequest signed with verification_key (signer=self) as POP.
* Exposed for testing; production code should call build_enrolment_request().
*/
ByteBuffer build_signed_enrolment_request(SecurityModule& security, const EnrolmentRequestParameters& parameters);
/**
* \brief Build the EA-encrypted enrolment request.
*
* Call .encode() on the result for the OER bytes to POST. The ECIES context
* held in the returned EncryptedData is also needed to decrypt the EA's
* response (same symmetric key via pskRecipInfo).
*/
EncryptedData build_enrolment_request(SecurityModule& security, const EnrolmentRequestParameters& parameters,
const Certificate& ea_certificate);
} // namespace pki
} // namespace vanetza