Base class for RSA family of algorithms.
More...
#include <jwt.h>
|
| 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 |
|
Base class for RSA family of algorithms.
◆ 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_key | RSA public key in PEM format |
private_key | RSA private key or empty string if not available. If empty, signing will always fail. |
public_key_password | Password to decrypt public key pem. |
private_key_password | Password to decrypt private key pem. |
md | Pointer to hash function |
name | Name of the algorithm |
◆ name()
std::string jwt::algorithm::rsa::name |
( |
| ) |
const |
|
inline |
Returns the algorithm name provided to the constructor
- Returns
- algorithm's name
◆ sign()
std::string jwt::algorithm::rsa::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
- RSA signature for the given data
◆ 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
-
data | The data to check signature against |
signature | Signature provided by the jwt |
ec | Filled with details on failure |
The documentation for this struct was generated from the following file: