Goby3  3.1.4
2024.02.22
jwt::algorithm::rsa Struct Reference

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

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

Inheritance diagram for jwt::algorithm::rsa:
jwt::algorithm::rs256 jwt::algorithm::rs384 jwt::algorithm::rs512

Public Member Functions

 rsa (const std::string &public_key, const std::string &private_key, const std::string &public_key_password, const std::string &private_key_password, 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 RSA family of algorithms.

Definition at line 1024 of file jwt.h.

Constructor & Destructor Documentation

◆ rsa()

jwt::algorithm::rsa::rsa ( const std::string &  public_key,
const std::string &  private_key,
const std::string &  public_key_password,
const std::string &  private_key_password,
const EVP_MD *(*)()  md,
std::string  name 
)
inline

Construct new rsa algorithm

Parameters
public_keyRSA public key in PEM format
private_keyRSA private key or empty string if not available. If empty, signing will always fail.
public_key_passwordPassword to decrypt public key pem.
private_key_passwordPassword to decrypt private key pem.
mdPointer to hash function
nameName of the algorithm

Definition at line 1035 of file jwt.h.

Member Function Documentation

◆ name()

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

Returns the algorithm name provided to the constructor

Returns
algorithm's name

Definition at line 1139 of file jwt.h.

◆ sign()

std::string jwt::algorithm::rsa::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
RSA signature for the given data

Definition at line 1057 of file jwt.h.

◆ verify()

void jwt::algorithm::rsa::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 on failure

Definition at line 1101 of file jwt.h.


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