Template Struct HMACSign
Defined in File algorithm.hpp
Struct Documentation
-
template<typename Hasher>
struct HMACSign OpenSSL HMAC based signature and verfication.
The template type
Hasher
takes the type representing the HMAC algorithm type from thejwt::algo
namespace.The struct is specialized for NONE algorithm. See the details of that class as well.
Public Static Functions
-
static inline sign_result_t sign(const jwt::string_view key, const jwt::string_view data)
Signs the input using the HMAC algorithm using the provided key.
Arguments: @key : The secret/key to use for the signing. Cannot be empty string. @data : The data to be signed.
Exceptions: Any allocation failure will result in jwt::MemoryAllocationException being thrown.
-
static verify_result_t verify(const jwt::string_view key, const jwt::string_view head, const jwt::string_view sign)
Verifies the JWT string against the signature using the provided key.
Arguments: @key : The secret/key to use for the signing. Cannot be empty string. @head : The part of JWT encoded string representing header and the payload claims. @sign : The signature part of the JWT encoded string.
Returns: verify_result_t verify_result_t::first set to true if verification succeeds. false otherwise. verify_result_t::second set to relevant error if verification fails.
Exceptions: Any allocation failure will result in jwt::MemoryAllocationException being thrown.
-
static inline sign_result_t sign(const jwt::string_view key, const jwt::string_view data)