ETSI STF525 / Internal Testing test suite
This project provides an internal testing test suite and its associated Test Adapter/Codec
Public Member Functions | Private Attributes | List of all members
hmac Class Reference

This class provides description of HMAC helper methods. More...

#include <hmac.hh>

Public Member Functions

 hmac (const hash_algorithms p_hash_algorithms)
 Default constructor Create a new instance of the hmac class. More...
 
virtual ~hmac ()
 Default destructor. More...
 
int generate (const std::vector< unsigned char > p_buffer, const std::vector< unsigned char > p_secret_key, std::vector< unsigned char > &p_hmac)
 Generate the HMAC of data using a secret key [in] p_buffer The data tobe hashed. More...
 
int generate (const unsigned char *p_buffer, const size_t p_buffer_length, const unsigned char *p_secret_key, const size_t p_secret_key_length, std::vector< unsigned char > &p_hmac)
 Generate the HMAC of data using a secret key. More...
 

Private Attributes

HMAC_CTX _ctx
 
hash_algorithms _hash_algorithms
 HMAC context. More...
 

Detailed Description

This class provides description of HMAC helper methods.

Constructor & Destructor Documentation

◆ hmac()

hmac::hmac ( const hash_algorithms  p_hash_algorithms)
inline

Default constructor Create a new instance of the hmac class.

Parameters
[in]p_hash_algorithmsThe hash algorithm to be used to compute the HMAC

◆ ~hmac()

virtual hmac::~hmac ( )
inlinevirtual

Default destructor.

Member Function Documentation

◆ generate() [1/2]

int hmac::generate ( const std::vector< unsigned char >  p_buffer,
const std::vector< unsigned char >  p_secret_key,
std::vector< unsigned char > &  p_hmac 
)
inline

Generate the HMAC of data using a secret key [in] p_buffer The data tobe hashed.

Parameters
[in]p_secret_keyThe secret key to be used to generate the HMAC
[out]p_hmacThe HMAC value based of the provided data
Returns
0 on success, -1 otherwise

◆ generate() [2/2]

int hmac::generate ( const unsigned char *  p_buffer,
const size_t  p_buffer_length,
const unsigned char *  p_secret_key,
const size_t  p_secret_key_length,
std::vector< unsigned char > &  p_hmac 
)
inline

Generate the HMAC of data using a secret key.

Parameters
[in]p_bufferThe data to be hashed
[in]p_buffer_lengthThe size of the data
[in]p_secret_keyThe secret key to be used to generate the HMAC
[in]p_secret_key_lengthThe size of the secret key
[out]p_hmacThe HMAC value based of the provided data
Returns
0 on success, -1 otherwise

Member Data Documentation

◆ _ctx

HMAC_CTX hmac::_ctx
private

◆ _hash_algorithms

hash_algorithms hmac::_hash_algorithms
private

HMAC context.


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