Vanetza
 
Loading...
Searching...
No Matches
vanetza::security::BackendCryptoPP Class Reference
Inheritance diagram for vanetza::security::BackendCryptoPP:

Public Types

using Ecdsa256 = CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA256 >
 
using Ecdsa384 = CryptoPP::ECDSA< CryptoPP::ECP, CryptoPP::SHA384 >
 

Public Member Functions

EcdsaSignature sign_data (const ecdsa256::PrivateKey &private_key, const ByteBuffer &data_buffer) override
 
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
 
boost::optional< Uncompresseddecompress_point (const EccPoint &ecc_point) override
 
ByteBuffer calculate_hash (KeyType, const ByteBuffer &) override
 
ecdsa256::KeyPair generate_key_pair ()
 generate a private key and the corresponding public key
 

Static Public Attributes

static constexpr auto backend_name = "CryptoPP"
 

Private Member Functions

EcdsaSignature sign_data (const Ecdsa256::PrivateKey &key, const ByteBuffer &data)
 internal sign method using crypto++ private key
 
bool verify_data (const Ecdsa256::PublicKey &key, const ByteBuffer &data, const ByteBuffer &sig)
 internal verify method using crypto++ public key
 
Ecdsa256::PrivateKey generate_private_key ()
 create private key
 
Ecdsa256::PublicKey generate_public_key (const Ecdsa256::PrivateKey &)
 derive public key from private key
 
Ecdsa256::PublicKey internal_public_key (const ecdsa256::PublicKey &)
 adapt generic public key to internal structure
 
Ecdsa256::PrivateKey internal_private_key (const ecdsa256::PrivateKey &)
 adapt generic private key to internal structure
 

Private Attributes

CryptoPP::AutoSeededRandomPool m_prng
 
LruCache< ecdsa256::PrivateKey, Ecdsa256::PrivateKey > m_private_cache
 
LruCache< ecdsa256::PublicKey, Ecdsa256::PublicKey > m_public_cache
 

Detailed Description

Definition at line 15 of file backend_cryptopp.hpp.

Member Typedef Documentation

◆ Ecdsa256

using vanetza::security::BackendCryptoPP::Ecdsa256 = CryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA256>

Definition at line 18 of file backend_cryptopp.hpp.

◆ Ecdsa384

using vanetza::security::BackendCryptoPP::Ecdsa384 = CryptoPP::ECDSA<CryptoPP::ECP, CryptoPP::SHA384>

Definition at line 19 of file backend_cryptopp.hpp.

Constructor & Destructor Documentation

◆ BackendCryptoPP()

vanetza::security::BackendCryptoPP::BackendCryptoPP ( )

Definition at line 132 of file backend_cryptopp.cpp.

Member Function Documentation

◆ calculate_hash()

ByteBuffer vanetza::security::BackendCryptoPP::calculate_hash ( KeyType  key,
const ByteBuffer &  buffer 
)
overridevirtual
See also
Backend::calculate_hash

Implements vanetza::security::Backend.

Definition at line 256 of file backend_cryptopp.cpp.

◆ decompress_point()

boost::optional< Uncompressed > vanetza::security::BackendCryptoPP::decompress_point ( const EccPoint &  ecc_point)
overridevirtual
See also
Backend::decompress_point

Implements vanetza::security::Backend.

Definition at line 202 of file backend_cryptopp.cpp.

◆ generate_key_pair()

ecdsa256::KeyPair vanetza::security::BackendCryptoPP::generate_key_pair ( )

generate a private key and the corresponding public key

Returns
generated key pair

Definition at line 280 of file backend_cryptopp.cpp.

◆ generate_private_key()

BackendCryptoPP::Ecdsa256::PrivateKey vanetza::security::BackendCryptoPP::generate_private_key ( )
private

create private key

Definition at line 297 of file backend_cryptopp.cpp.

◆ generate_public_key()

BackendCryptoPP::Ecdsa256::PublicKey vanetza::security::BackendCryptoPP::generate_public_key ( const Ecdsa256::PrivateKey &  private_key)
private

derive public key from private key

Definition at line 306 of file backend_cryptopp.cpp.

◆ internal_private_key()

BackendCryptoPP::Ecdsa256::PrivateKey vanetza::security::BackendCryptoPP::internal_private_key ( const ecdsa256::PrivateKey generic)
private

adapt generic private key to internal structure

Definition at line 326 of file backend_cryptopp.cpp.

◆ internal_public_key()

BackendCryptoPP::Ecdsa256::PublicKey vanetza::security::BackendCryptoPP::internal_public_key ( const ecdsa256::PublicKey generic)
private

adapt generic public key to internal structure

Definition at line 314 of file backend_cryptopp.cpp.

◆ sign_data() [1/2]

EcdsaSignature vanetza::security::BackendCryptoPP::sign_data ( const Ecdsa256::PrivateKey &  key,
const ByteBuffer &  data 
)
private

internal sign method using crypto++ private key

Definition at line 143 of file backend_cryptopp.cpp.

◆ sign_data() [2/2]

EcdsaSignature vanetza::security::BackendCryptoPP::sign_data ( const ecdsa256::PrivateKey private_key,
const ByteBuffer &  data_buffer 
)
overridevirtual
See also
Backend::sign_data

Implements vanetza::security::Backend.

Definition at line 138 of file backend_cryptopp.cpp.

◆ verify_data() [1/2]

bool vanetza::security::BackendCryptoPP::verify_data ( const Ecdsa256::PublicKey &  key,
const ByteBuffer &  data,
const ByteBuffer &  sig 
)
private

internal verify method using crypto++ public key

Definition at line 196 of file backend_cryptopp.cpp.

◆ verify_data() [2/2]

bool vanetza::security::BackendCryptoPP::verify_data ( const ecdsa256::PublicKey public_key,
const ByteBuffer &  data,
const EcdsaSignature sig 
)
overridevirtual
See also
Backend::verify_data

Implements vanetza::security::Backend.

Definition at line 166 of file backend_cryptopp.cpp.

◆ verify_digest()

bool vanetza::security::BackendCryptoPP::verify_digest ( const PublicKey public_key,
const ByteBuffer &  digest,
const Signature sig 
)
overridevirtual
See also
Backend::verify_digest

Implements vanetza::security::Backend.

Definition at line 172 of file backend_cryptopp.cpp.

Member Data Documentation

◆ backend_name

constexpr auto vanetza::security::BackendCryptoPP::backend_name = "CryptoPP"
staticconstexpr

Definition at line 21 of file backend_cryptopp.hpp.

◆ m_private_cache

LruCache<ecdsa256::PrivateKey, Ecdsa256::PrivateKey> vanetza::security::BackendCryptoPP::m_private_cache
private

Definition at line 66 of file backend_cryptopp.hpp.

◆ m_prng

CryptoPP::AutoSeededRandomPool vanetza::security::BackendCryptoPP::m_prng
private

Definition at line 65 of file backend_cryptopp.hpp.

◆ m_public_cache

LruCache<ecdsa256::PublicKey, Ecdsa256::PublicKey> vanetza::security::BackendCryptoPP::m_public_cache
private

Definition at line 67 of file backend_cryptopp.hpp.


The documentation for this class was generated from the following files: