JWT-CPP v0.7.0
A header only library for creating and validating JSON Web Tokens (JWT) in C++
Loading...
Searching...
No Matches
jwt::algorithm::hmacsha Struct Reference

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

#include <jwt.h>

Inheritance diagram for jwt::algorithm::hmacsha:
[legend]

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.

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

Member Function Documentation

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

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