Vanetza
 
Loading...
Searching...
No Matches
backend_openssl.hpp
1#ifndef BACKEND_OPENSSL_HPP_CRRV8DCH
2#define BACKEND_OPENSSL_HPP_CRRV8DCH
3
4#include <vanetza/security/backend.hpp>
5#include <array>
6#include <cstdint>
7
8namespace vanetza
9{
10namespace security
11{
12
13// forward declaration
14namespace openssl
15{
16 class Key;
17 class Point;
18 class Signature;
19} // namespace openssl
20
21
22/**
23 * \brief Backend implementation based on OpenSSL
24 */
25class BackendOpenSsl : public Backend
26{
27public:
28 static constexpr auto backend_name = "OpenSSL";
29
31
32 /// \see Backend::sign_data
33 EcdsaSignature sign_data(const ecdsa256::PrivateKey& private_key, const ByteBuffer& data_buffer) override;
34
35 /// \see Backend::verify_data
36 bool verify_data(const ecdsa256::PublicKey& public_key, const ByteBuffer& data, const EcdsaSignature& sig) override;
37
38 /// \see Backend::verify_digest
39 bool verify_digest(const PublicKey&, const ByteBuffer& digest, const Signature&) override;
40
41 ByteBuffer calculate_hash(KeyType, const ByteBuffer&) override;
42
43 /// \see Backend::decompress_point
44 boost::optional<Uncompressed> decompress_point(const EccPoint& ecc_point) override;
45
46private:
47 /// calculate SHA256 digest of data buffer
48 std::array<uint8_t, 32> calculate_sha256_digest(const ByteBuffer& data) const;
49
50 /// calculate SHA384 digest of data buffer
51 std::array<uint8_t, 48> calculate_sha384_digest(const ByteBuffer& data) const;
52
53 /// convert to internal format of private key
55
56 /// convert to internal format of public key
59
60 /// convert to internal format of an EC point
62};
63
64} // namespace security
65} // namespace vanetza
66
67#endif /* BACKEND_OPENSSL_HPP_CRRV8DCH */
Backend implementation based on OpenSSL.
std::array< uint8_t, 32 > calculate_sha256_digest(const ByteBuffer &data) const
calculate SHA256 digest of data buffer
bool verify_data(const ecdsa256::PublicKey &public_key, const ByteBuffer &data, const EcdsaSignature &sig) override
bool verify_digest(const PublicKey &, const ByteBuffer &digest, const Signature &) override
std::array< uint8_t, 48 > calculate_sha384_digest(const ByteBuffer &data) const
calculate SHA384 digest of data buffer
openssl::Key internal_public_key(const ecdsa256::PublicKey &) const
convert to internal format of public key
openssl::Point internal_ec_point(const PublicKey &) const
convert to internal format of an EC point
EcdsaSignature sign_data(const ecdsa256::PrivateKey &private_key, const ByteBuffer &data_buffer) override
boost::optional< Uncompressed > decompress_point(const EccPoint &ecc_point) override
openssl::Key internal_private_key(const ecdsa256::PrivateKey &) const
convert to internal format of private key
EcdsaSignature specified in TS 103 097 v1.2.1, section 4.2.9.
Definition: signature.hpp:17