libjwt-1.17.0
|
Set and check algorithms and algorithm specific values. More...
Functions | |
int | jwt_set_alg (jwt_t *jwt, jwt_alg_t alg, const unsigned char *key, int len) |
Set an algorithm from jwt_alg_t for this JWT object. | |
jwt_alg_t | jwt_get_alg (const jwt_t *jwt) |
Get the jwt_alg_t set for this JWT object. | |
const char * | jwt_alg_str (jwt_alg_t alg) |
Convert alg type to it's string representation. | |
jwt_alg_t | jwt_str_alg (const char *alg) |
Convert alg string to type. | |
Set and check algorithms and algorithm specific values.
When working with functions that require a key, the underlying library takes care to scrub memory when the key is no longer used (e.g. when calling jwt_free() or when changing the algorithm, the old key, if it exists, is scrubbed).
const char * jwt_alg_str | ( | jwt_alg_t | alg | ) |
Convert alg type to it's string representation.
Returns a string that matches the alg type provided.
alg | A valid jwt_alg_t specifier. |
Get the jwt_alg_t set for this JWT object.
Returns the jwt_alg_t type for this JWT object.
jwt | Pointer to a JWT object. |
Set an algorithm from jwt_alg_t for this JWT object.
Specifies an algorithm for a JWT object. If JWT_ALG_NONE is used, then key must be NULL and len must be 0. All other algorithms must have a valid pointer to key data, which may be specific to the algorithm (e.g RS256 expects a PEM formatted RSA key).
jwt | Pointer to a JWT object. |
alg | A valid jwt_alg_t specifier. |
key | The key data to use for the algorithm. |
len | The length of the key data. |
jwt_alg_t jwt_str_alg | ( | const char * | alg | ) |
Convert alg string to type.
Returns an alg type based on the string representation.
alg | A valid string algorithm type (e.g. "RS256"). |
Note, this only works for algorithms that LibJWT supports or knows about.