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

77 lines
1.9 KiB
C++

#ifndef RECIPIENT_INFO_HPP_IENLXEUN
#define RECIPIENT_INFO_HPP_IENLXEUN
#include <vanetza/security/v2/basic_elements.hpp>
#include <vanetza/security/v2/public_key.hpp>
#include <boost/variant/variant.hpp>
namespace vanetza
{
namespace security
{
namespace v2
{
/// EciesEncryptedKey specified in TS 103 097 v1.2.1, section 5.9
struct EciesEncryptedKey
{
EccPoint v;
ByteBuffer c;
std::array<uint8_t, 16> t;
};
/// OpaqueKey specified in TS 103 097 v1.2.1, section 5.8
struct OpaqueKey
{
ByteBuffer data;
};
/// Key specified in TS 103 097 v1.2.1, section 5.8 (in RecipientInfo)
typedef boost::variant<EciesEncryptedKey, OpaqueKey> Key;
/// RecipientInfo specified in TS 103 097 v1.2.1, section 5.8
struct RecipientInfo
{
HashedId8 cert_id;
Key enc_key;
PublicKeyAlgorithm pk_encryption() const;
};
/**
* \brief Determines applicable PublicKeyAlgorithm
* \param key Algorithm has to fit this kind of key
* \return PublicKeyAlgorithm
*/
PublicKeyAlgorithm get_type(const Key&);
/**
* Calculates size of a RecipientInfo
* \param info
* \return number of octets needed to serialize the RecipientInfo
*/
size_t get_size(const RecipientInfo&);
/**
* \brief Serializes a RecipientInfo into a binary archive
* \param ar Destination of serialized object
* \param info RecipientInfo to serialize
* \param sym Applicable symmetric algorithm
*/
void serialize(OutputArchive&, const RecipientInfo&, SymmetricAlgorithm);
/**
* \brief Deserialize a RecipientInfo
* \param ar Input starting with serialized RecipientInfo
* \param info Deserialized RecipientInfo
* \param sym Symmetric algorithm required to deserialize encrypted key
* \return size of the deserialized RecipientInfo in bytes
*/
size_t deserialize(InputArchive&, RecipientInfo&, const SymmetricAlgorithm&);
} // namespace v2
} // namespace security
} // namespace vanetza
#endif /* RECIPIENT_INFO_HPP_IENLXEUN */