CryptoSys API
6.22.1
|
Message authentication code (MAC) functions. More...
Public Types | |
enum class | Alg |
Message Authentication Code (MAC) Algorithm More... | |
Public Member Functions | |
int | AddData (bvec_t data) |
Adds a chunk of data in a byte array to be digested by the Mac object. More... | |
int | AddData (std::string s) |
Adds a chunk of data in a string to be digested by the Mac object. More... | |
bvec_t | Final () |
Computes final MAC value for the Mac object. More... | |
bool | Init (bvec_t key, Alg alg) |
Initialises the Mac object ready for repeated incremental operations. More... | |
Static Public Member Functions | |
static bvec_t | BytesFromBytes (const bvec_t &data, const bvec_t &key, Alg alg=Alg::HmacSha1) |
Computes MAC value in byte format from byte input. More... | |
static std::string | HexFromBytes (const bvec_t &data, const bvec_t &key, Alg alg=Alg::HmacSha1) |
Computes MAC value in hex-encoded format from byte input. More... | |
static std::string | HexFromHex (const std::string &dataHex, const std::string &keyHex, Alg alg=Alg::HmacSha1) |
Computes MAC value in hex-encoded format from hex-encoded input. More... | |
static std::string | HexFromString (const std::string &s, const bvec_t &key, Alg alg=Alg::HmacSha1) |
Computes MAC value in hex-encoded format from string input. More... | |
Message authentication code (MAC) functions.
|
strong |
Message Authentication Code (MAC) Algorithm
int crsysapi::Mac::AddData | ( | bvec_t | data | ) |
Adds a chunk of data in a byte array to be digested by the Mac object.
data | Data to add |
std::runtime_error | if object is not valid. |
int crsysapi::Mac::AddData | ( | std::string | s | ) |
Adds a chunk of data in a string to be digested by the Mac object.
s | Data to add |
std::runtime_error | if object is not valid. |
|
static |
Computes MAC value in byte format from byte input.
data | Message to be signed in byte array |
key | Key in byte array |
alg | MAC algorithm to be used |
bvec_t crsysapi::Mac::Final | ( | ) |
Computes final MAC value for the Mac object.
std::runtime_error | if object is not valid. |
|
static |
Computes MAC value in hex-encoded format from byte input.
data | Message to be signed in byte array |
key | Key in byte array |
alg | MAC algorithm to be used |
|
static |
Computes MAC value in hex-encoded format from hex-encoded input.
dataHex | Message to be signed in hex-encoded format |
keyHex | Key in hex-encoded format |
alg | MAC algorithm to be used |
|
static |
Computes MAC value in hex-encoded format from string input.
s | Message to be signed as a string |
key | Key in byte array |
alg | MAC algorithm to be used |
Initialises the Mac object ready for repeated incremental operations.
key | Key in byte array. |
alg | Mac algorithm to be used |
std::runtime_error | if algorithm is not supported. |