1#ifndef BACKEND_CRYPTOPP_HPP_JQWA9MLZ
2#define BACKEND_CRYPTOPP_HPP_JQWA9MLZ
4#include <vanetza/security/backend.hpp>
5#include <cryptopp/eccrypto.h>
6#include <cryptopp/osrng.h>
7#include <cryptopp/sha.h>
17 using Ecdsa256 = CryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA256>;
18 using Ecdsa384 = CryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA384>;
20 static constexpr auto backend_name =
"CryptoPP";
37 boost::optional<Uncompressed>
decompress_point(
const EccPoint& ecc_point)
override;
40 ByteBuffer
calculate_hash(HashAlgorithm,
const ByteBuffer&)
override;
53 bool verify_data(
const Ecdsa256::PublicKey& key,
const ByteBuffer& data,
const ByteBuffer& sig);
67 CryptoPP::AutoSeededRandomPool m_prng;
Ecdsa256::PrivateKey generate_private_key()
create private key
Ecdsa256::PublicKey internal_public_key(const ecdsa256::PublicKey &)
adapt generic public key to internal structure
ByteBuffer calculate_hash(HashAlgorithm, const ByteBuffer &) override
boost::optional< Uncompressed > decompress_point(const EccPoint &ecc_point) override
Ecdsa256::PublicKey generate_public_key(const Ecdsa256::PrivateKey &)
derive public key from private key
bool verify_data(const ecdsa256::PublicKey &public_key, const ByteBuffer &data, const EcdsaSignature &sig) override
Signature sign_digest(const PrivateKey &, const ByteBuffer &digest) override
EcdsaSignature sign_data(const ecdsa256::PrivateKey &private_key, const ByteBuffer &data_buffer) override
bool verify_digest(const PublicKey &, const ByteBuffer &digest, const Signature &) override
ecdsa256::KeyPair generate_key_pair()
generate a private key and the corresponding public key
Ecdsa256::PrivateKey internal_private_key(const ecdsa256::PrivateKey &)
adapt generic private key to internal structure
EcdsaSignature specified in TS 103 097 v1.2.1, section 4.2.9.