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

67 lines
2.2 KiB
C++

#pragma once
#include "keys.hpp"
#include "psid_ssp.hpp"
#include <vanetza/common/byte_buffer.hpp>
#include <vanetza/common/clock.hpp>
#include <vanetza/security/hash_algorithm.hpp>
#include <boost/optional/optional.hpp>
#include <chrono>
#include <list>
namespace vanetza
{
namespace pki
{
class Certificate;
class EncryptedData;
class SecurityModule;
using security::HashAlgorithm;
/**
* \brief Hint for sharedAtRequest.requestedSubjectAttributes.validityPeriod.
* \see IEEE 1609.2 Time32 / Duration::hours
*/
struct ValidityPeriodHint
{
Clock::time_point start;
std::chrono::hours duration;
};
/**
* \brief Parameters for an AuthorizationRequest (encryptedEcSignature variant).
* \see TS 102 941 §6.2.3.3.1
*/
struct AuthorizationRequestParameters
{
const Certificate* ec = nullptr; // current EC, signs the inner EC proof; mandatory
const Certificate* ea_certificate = nullptr; // recipient of encryptedEcSignature; mandatory
const Certificate* aa_certificate = nullptr; // recipient of outer encryption; mandatory
PublicKey verification_key; // fresh key to be certified; private key in SecurityModule; mandatory
boost::optional<PublicKey> at_encryption_key; // optional encryption key embedded in the AT
std::list<PsidSsp> permissions; // requested PSID/SSP set; must be non-empty
HashAlgorithm hash_algo = HashAlgorithm::SHA256; // EC proof and extDataHash; SHA-256 only
boost::optional<ValidityPeriodHint> validity_period; // optional; AA decides within CP §7.2.1 bounds
bool include_pop = true; // send AuthorizationRequestMessageWithPop; required by deployed AAs
};
/**
* \brief Build the inner EtsiTs102941Data{authorizationRequest} plaintext.
*
* Exposed for testing; production code should call build_authorization_request().
*/
ByteBuffer build_signed_authorization_request(SecurityModule& security,
const AuthorizationRequestParameters& parameters);
/**
* \brief Build the AA-encrypted authorization request.
*
* Call .encode() on the result for the OER bytes to POST as `application/x-its-request`.
*/
EncryptedData build_authorization_request(SecurityModule& security, const AuthorizationRequestParameters& parameters);
} // namespace pki
} // namespace vanetza