Goby3  3.1.5a
2024.05.23
jwt::algorithm::hmacsha Struct Reference

Base class for HMAC family of algorithms. More...

#include <goby/util/thirdparty/jwt-cpp/jwt.h>

Inheritance diagram for jwt::algorithm::hmacsha:
jwt::algorithm::hs256 jwt::algorithm::hs384 jwt::algorithm::hs512

Public Member Functions

 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
 

Detailed Description

Base class for HMAC family of algorithms.

Definition at line 947 of file jwt.h.

Constructor & Destructor Documentation

◆ hmacsha()

jwt::algorithm::hmacsha::hmacsha ( std::string  key,
const EVP_MD *(*)()  md,
std::string  name 
)
inline

Construct new hmac algorithm

Parameters
keyKey to use for HMAC
mdPointer to hash function
nameName of the algorithm

Definition at line 955 of file jwt.h.

Member Function Documentation

◆ name()

std::string jwt::algorithm::hmacsha::name ( ) const
inline

Returns the algorithm name provided to the constructor

Returns
algorithm's name

Definition at line 1011 of file jwt.h.

◆ sign()

std::string jwt::algorithm::hmacsha::sign ( const std::string &  data,
std::error_code &  ec 
) const
inline

Sign jwt data

Parameters
dataThe data to sign
ecerror_code filled with details on error
Returns
HMAC signature for the given data

Definition at line 965 of file jwt.h.

◆ 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
dataThe data to check signature against
signatureSignature provided by the jwt
ecFilled with details about failure.

Definition at line 988 of file jwt.h.


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