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).
67 lines
2.2 KiB
C++
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
|