Base class for HMAC family of algorithms.
More...
#include <jwt.h>
|
| hmacsha (std::string key, const EVP_MD *(*md)(), std::string name) |
|
std::string | sign (const std::string &data, std::error_code &ec) const |
|
void | verify (const std::string &data, const std::string &signature, std::error_code &ec) const |
|
std::string | name () const |
|
Base class for HMAC family of algorithms.
◆ hmacsha()
jwt::algorithm::hmacsha::hmacsha |
( |
std::string | key, |
|
|
const EVP_MD *(*)() | md, |
|
|
std::string | name ) |
|
inline |
Construct new hmac algorithm
- Parameters
-
key | Key to use for HMAC |
md | Pointer to hash function |
name | Name of the algorithm |
◆ name()
std::string jwt::algorithm::hmacsha::name |
( |
| ) |
const |
|
inline |
Returns the algorithm name provided to the constructor
- Returns
- algorithm's name
◆ sign()
std::string jwt::algorithm::hmacsha::sign |
( |
const std::string & | data, |
|
|
std::error_code & | ec ) const |
|
inline |
Sign jwt data
- Parameters
-
data | The data to sign |
ec | error_code filled with details on error |
- Returns
- HMAC signature for the given data
◆ verify()
void jwt::algorithm::hmacsha::verify |
( |
const std::string & | data, |
|
|
const std::string & | signature, |
|
|
std::error_code & | ec ) const |
|
inline |
Check if signature is valid
- Parameters
-
data | The data to check signature against |
signature | Signature provided by the jwt |
ec | Filled with details about failure. |
The documentation for this struct was generated from the following file: