Files
MicrOBU/microbu-esp32c5/external/vanetza-idf/vanetza/security/decap_service.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

92 lines
3.0 KiB
C++

#ifndef F815BB22_3075_4A9D_9385_07876D800765
#define F815BB22_3075_4A9D_9385_07876D800765
#include <vanetza/common/its_aid.hpp>
#include <vanetza/net/packet_variant.hpp>
#include <vanetza/security/certificate_validity.hpp>
#include <vanetza/security/hashed_id.hpp>
#include <vanetza/security/secured_message.hpp>
#include <vanetza/security/verify_service.hpp>
#include <boost/optional/optional.hpp>
#include <boost/variant/variant.hpp>
namespace vanetza
{
namespace security
{
/**
* \brief Input data for decapsulating a secured message.
*
* The structure is equivalent to VerifyRequest, however, decapsulation may
* also deal with decryption in future versions.
*
* \see TS 102 723-8 v1.1.1 SN-DECAP.request
*/
struct DecapRequest
{
DecapRequest(SecuredMessageView sec_msg_view) : sec_packet(sec_msg_view) {}
SecuredMessageView sec_packet;
};
/**
* \brief SN-DECAP.confirm report codes
* \see TS 102 723-8 v1.1.1 table 27 (report field)
*
* Instead of duplicating VerificationReport values and the linked burden keeping
* these values consistent, DecapReport is a variant incorporating VerificationReport.
* When decryption is implemented, a DecryptionReport may be added to the variant.
*
* The boost::blank entry indicates that the SecuredMessage was neither signed nor encrypted.
*/
using DecapReport = boost::variant<boost::blank, VerificationReport>;
/**
* \brief Check if report indicates a successful decapsulation.
*
* Either verification or decryption needs to be successful.
* An unsecured message cannot lead to a succesful decapsulation result.
*
* \param report to check
* \return true if either verification or decryption was successful
*/
bool is_successful(const DecapReport& report);
/**
* \brief Check if decapsulation report matches a particular verification report.
*
* \param decap decapsulation report
* \param verification verification report
* \return true if decapsulation matches verification
*/
bool operator==(const DecapReport& decap, VerificationReport verification);
bool operator==(VerificationReport verification, const DecapReport& decap);
/**
* \brief SN-DECAP.confirm
* \see TS 102 723-8 v1.1.1 table 27
*/
struct DecapConfirm
{
/**
* Build DecapConfirm from verify outcome and secured message.
*
* \param verify_confirm outcome of verification
* \param msg_view view of secured message
* \return decapsulation confirmation
*/
static DecapConfirm from(VerifyConfirm&& verify_confirm, const SecuredMessageView& msg_view);
PacketVariant plaintext_payload; // mandatory (plaintext_packet_length also covered by data type)
DecapReport report; // mandatory
CertificateValidity certificate_validity; // non-standard extension
boost::optional<HashedId8> certificate_id; // optional
ItsAid its_aid; // mandatory (its_ait_lenth also covered by data type)
ByteBuffer permissions; // mandatory
};
} // namespace security
} // namespace vanetza
#endif /* F815BB22_3075_4A9D_9385_07876D800765 */