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

64 lines
1.7 KiB
C++

#ifndef VANETZA_SECURITY_PERSISTENCE_HPP
#define VANETZA_SECURITY_PERSISTENCE_HPP
#include <vanetza/security/ecdsa256.hpp>
#include <vanetza/security/v2/certificate.hpp>
#include <vanetza/security/v2/public_key.hpp>
#include <iosfwd>
namespace vanetza
{
namespace security
{
namespace v2
{
/**
* \brief Loads a private key from a file
* \param key_path file to load the key from
* \return loaded key
*/
ecdsa256::KeyPair load_private_key_from_file(const std::string& key_path);
/**
* \brief Save a private key pair to a stream in PKCS#8 DER format (secp256r1)
* \param os destination stream
* \param key_pair key pair to be stored
* \return true if successfully written
*/
bool save_private_key_pkcs8_der(std::ostream& os, const ecdsa256::KeyPair& key_pair);
/**
* \brief Loads a public key from a file
* \param key_path file to load the key from
* \return loaded key
*/
PublicKey load_public_key_from_file(const std::string& key_path);
/**
* \brief Saves a public key to a file
* \param key_path file to save the key to
* \param public_key key to save
*/
void save_public_key_to_file(const std::string& key_path, const PublicKey& public_key);
/**
* \brief Loads a certificate from a file
* \param certificate_path file to load the certificate from
* \return loaded certificate
*/
Certificate load_certificate_from_file(const std::string& certificate_path);
/**
* \brief Saves a certificate to a file
* \param certificate_path file to save the certificate to
* \param certificate certificate to save
*/
void save_certificate_to_file(const std::string& certificate_path, const Certificate& certificate);
} // namespace v2
} // namespace security
} // namespace vanetza
#endif /* VANETZA_SECURITY_PERSISTENCE_HPP */