Files
MicrOBU/microbu-esp32c5/external/vanetza-idf/tools/pki/at_response.hpp
T
Ashin Walpola 0e9525162d Keep the colleague's microbu-esp32c5 tree in this repository
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).
2026-09-23 17:46:40 +02:00

55 lines
1.8 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;
// Result of parsing a decrypted AuthorizationResponse payload as specified
// in ETSI TS 102 941 §6.2.3.3.2.
struct AuthorizationResponse
{
// Response code from InnerAtResponse. Parsing succeeds regardless of
// the code value; the caller decides how to act on non-ok results.
AuthorizationResponseCode code;
// requestHash from InnerAtResponse (SHA-256 prefix of the request).
ByteBuffer request_hash;
// New Authorization Ticket returned by the AA. Present iff the parser
// was able to decode a certificate; the caller must still check that
// `code` is `ok` before relying on it.
boost::optional<Certificate> certificate;
};
/**
* Parse a decrypted AuthorizationResponse per TS 102 941 §6.2.3.3.2.
*
* Verifies:
* - outer Ieee1609Dot2Data is signedData
* - signer = digest, matching HashedId8(aa_certificate)
* - tbsData.headerInfo.psid == aid::SCR
* - outer signature verifies against aa_certificate
* - inner EtsiTs102941Data.version == v1
* - inner content variant is authorizationResponse
*
* If `code == ok` the message MUST carry a certificate per TS 102 941;
* for non-ok codes the parser returns normally with whatever certificate
* (if any) was provided.
*
* \throws DecodingFailure on structural failure or missing required certificate
* \throws VerificationFailure on signer-digest or signature mismatch
*/
AuthorizationResponse parse_authorization_response(SecurityModule& security, const ByteBuffer& decrypted,
const Certificate& aa_certificate);
} // namespace pki
} // namespace vanetza