GNSS-SDR 0.0.21
An Open Source GNSS Software Defined Receiver
Loading...
Searching...
No Matches
Gnss_Crypto Class Reference

Class implementing cryptographic functions for Navigation Message Authentication. More...

#include <gnss_crypto.h>

Public Member Functions

 Gnss_Crypto ()
 Default constructor.
 Gnss_Crypto (const std::string &certFilePath, const std::string &merkleTreePath)
 ~Gnss_Crypto ()
 Default destructor.
bool have_public_key () const
 Returns true if the ECDSA Public Key is already loaded.
bool store_public_key (const std::string &pubKeyFilePath) const
bool verify_signature_ecdsa_p256 (const std::vector< uint8_t > &message, const std::vector< uint8_t > &signature) const
 Verify ECDSA-P256 signature (message in plain hex, signature in raw format).
bool verify_signature_ecdsa_p521 (const std::vector< uint8_t > &message, const std::vector< uint8_t > &signature) const
 Verify ECDSA-P521 signature (message in plain hex, signature in raw format).
std::vector< uint8_t > compute_SHA_256 (const std::vector< uint8_t > &input) const
 Computes SHA-256 hash.
std::vector< uint8_t > compute_SHA3_256 (const std::vector< uint8_t > &input) const
 Computes SHA3-256 hash.
std::vector< uint8_t > compute_HMAC_SHA_256 (const std::vector< uint8_t > &key, const std::vector< uint8_t > &input) const
 Computes HMAC-SHA-256 message authentication code.
std::vector< uint8_t > compute_CMAC_AES (const std::vector< uint8_t > &key, const std::vector< uint8_t > &input) const
 Computes CMAC-AES message authentication code.
std::vector< uint8_t > get_merkle_root () const
 Gets the Merkle Tree root node ( \( x_{4,0} \)).
std::string get_public_key_type () const
 Gets the ECDSA Public Key type (ECDSA P-256 / ECDSA P-521 / Unknown).
void set_public_key (const std::vector< uint8_t > &publickey)
 Sets the ECDSA Public Key (publickey compressed format).
void set_public_key_type (const std::string &public_key_type)
 Sets the ECDSA Public Key type (ECDSA P-256 / ECDSA P-521).
void set_merkle_root (const std::vector< uint8_t > &v)
 Sets the Merkle Tree root node x( \( x_{4,0} \)).
void read_merkle_xml (const std::string &merkleFilePath)

Detailed Description

Class implementing cryptographic functions for Navigation Message Authentication.

Definition at line 41 of file gnss_crypto.h.

Constructor & Destructor Documentation

◆ Gnss_Crypto() [1/2]

Gnss_Crypto::Gnss_Crypto ( )

Default constructor.

◆ Gnss_Crypto() [2/2]

Gnss_Crypto::Gnss_Crypto ( const std::string & certFilePath,
const std::string & merkleTreePath )

Constructor with a .crt or .pem file for the ECDSA Public Key and a XML file for the Merkle Tree root. Files can be downloaded by registering at https://www.gsc-europa.eu/

◆ ~Gnss_Crypto()

Gnss_Crypto::~Gnss_Crypto ( )

Default destructor.

Member Function Documentation

◆ compute_CMAC_AES()

std::vector< uint8_t > Gnss_Crypto::compute_CMAC_AES ( const std::vector< uint8_t > & key,
const std::vector< uint8_t > & input ) const

Computes CMAC-AES message authentication code.

◆ compute_HMAC_SHA_256()

std::vector< uint8_t > Gnss_Crypto::compute_HMAC_SHA_256 ( const std::vector< uint8_t > & key,
const std::vector< uint8_t > & input ) const

Computes HMAC-SHA-256 message authentication code.

◆ compute_SHA3_256()

std::vector< uint8_t > Gnss_Crypto::compute_SHA3_256 ( const std::vector< uint8_t > & input) const

Computes SHA3-256 hash.

◆ compute_SHA_256()

std::vector< uint8_t > Gnss_Crypto::compute_SHA_256 ( const std::vector< uint8_t > & input) const

Computes SHA-256 hash.

◆ get_merkle_root()

std::vector< uint8_t > Gnss_Crypto::get_merkle_root ( ) const

Gets the Merkle Tree root node ( \( x_{4,0} \)).

◆ get_public_key_type()

std::string Gnss_Crypto::get_public_key_type ( ) const

Gets the ECDSA Public Key type (ECDSA P-256 / ECDSA P-521 / Unknown).

◆ have_public_key()

bool Gnss_Crypto::have_public_key ( ) const

Returns true if the ECDSA Public Key is already loaded.

◆ set_merkle_root()

void Gnss_Crypto::set_merkle_root ( const std::vector< uint8_t > & v)

Sets the Merkle Tree root node x( \( x_{4,0} \)).

◆ set_public_key()

void Gnss_Crypto::set_public_key ( const std::vector< uint8_t > & publickey)

Sets the ECDSA Public Key (publickey compressed format).

◆ set_public_key_type()

void Gnss_Crypto::set_public_key_type ( const std::string & public_key_type)

Sets the ECDSA Public Key type (ECDSA P-256 / ECDSA P-521).

◆ store_public_key()

bool Gnss_Crypto::store_public_key ( const std::string & pubKeyFilePath) const

Stores the ECDSA Public Key in a .pem file, which is read in a following run if the .crt file is not found

◆ verify_signature_ecdsa_p256()

bool Gnss_Crypto::verify_signature_ecdsa_p256 ( const std::vector< uint8_t > & message,
const std::vector< uint8_t > & signature ) const

Verify ECDSA-P256 signature (message in plain hex, signature in raw format).

◆ verify_signature_ecdsa_p521()

bool Gnss_Crypto::verify_signature_ecdsa_p521 ( const std::vector< uint8_t > & message,
const std::vector< uint8_t > & signature ) const

Verify ECDSA-P521 signature (message in plain hex, signature in raw format).


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