|
LibJWT 3.8.0
The C JSON Web Token Library +JWK +JWKS
|
Convert between algorithm types and their string names. More...
Functions | |
| jwt_alg_t | jwt_get_alg (const jwt_t *jwt) |
| const char * | jwt_alg_str (jwt_alg_t alg) |
| jwt_alg_t | jwt_str_alg (const char *alg) |
| const char * | jwe_alg_str (jwe_key_alg_t alg) |
| jwe_key_alg_t | jwe_str_alg (const char *alg) |
| const char * | jwe_enc_str (jwe_enc_t enc) |
| jwe_enc_t | jwe_str_enc (const char *enc) |
Convert between algorithm types and their string names.
Utility functions to convert between string and type for alg
| enum jwe_enc_t |
JWE content encryption algorithm types.
These are the supported JWE "enc" (content encryption) algorithm types for LibJWT. They determine the authenticated encryption applied to the plaintext using the CEK.
| enum jwe_key_alg_t |
JWE key management algorithm types.
These are the supported JWE "alg" (key management) algorithm types for LibJWT. They determine how the Content Encryption Key (CEK) is produced for or recovered from a recipient. They are intentionally a separate type from jwt_alg_t (which is JWS/signing only); the "alg" values used in JWE and JWS are not the same.
| Enumerator | |
|---|---|
| JWE_ALG_NONE | No/unset key management algorithm |
| JWE_ALG_DIR | Direct use of a shared symmetric key as the CEK |
| JWE_ALG_A128KW | AES Key Wrap with 128-bit key |
| JWE_ALG_A192KW | AES Key Wrap with 192-bit key |
| JWE_ALG_A256KW | AES Key Wrap with 256-bit key |
| JWE_ALG_RSA_OAEP | RSAES-OAEP using default (SHA-1) parameters |
| JWE_ALG_RSA_OAEP_256 | RSAES-OAEP using SHA-256 and MGF1 with SHA-256 |
| JWE_ALG_ECDH_ES | ECDH-ES using Concat KDF (Direct Key Agreement). The agreed key is the CEK, derived at the length the "enc" requires, so every jwe_enc_t works, including the 48- and 64-octet CEKs of A192CBC-HS384 and A256CBC-HS512 (before 3.8.0 these were rejected). |
| JWE_ALG_ECDH_ES_A128KW | ECDH-ES using Concat KDF and CEK wrapped with A128KW |
| JWE_ALG_ECDH_ES_A192KW | ECDH-ES using Concat KDF and CEK wrapped with A192KW |
| JWE_ALG_ECDH_ES_A256KW | ECDH-ES using Concat KDF and CEK wrapped with A256KW |
| JWE_ALG_A128GCMKW | Key wrapping with AES GCM using a 128-bit key
|
| JWE_ALG_A192GCMKW | Key wrapping with AES GCM using a 192-bit key
|
| JWE_ALG_A256GCMKW | Key wrapping with AES GCM using a 256-bit key
|
| JWE_ALG_PBES2_HS256_A128KW | PBES2 with HMAC SHA-256 and A128KW wrapping
|
| JWE_ALG_PBES2_HS384_A192KW | PBES2 with HMAC SHA-384 and A192KW wrapping
|
| JWE_ALG_PBES2_HS512_A256KW | PBES2 with HMAC SHA-512 and A256KW wrapping
|
| JWE_ALG_INVAL | An invalid algorithm from the caller or the token |
| enum jwe_serialization_t |
JWE serialization formats.
RFC 7516 defines two serializations. The Compact Serialization is the five-part header.encrypted_key.iv.ciphertext.tag string and supports a single recipient. The JSON Serialization is a JSON object; its Flattened form is the single-recipient special case, and its General form carries a recipients array for one or more recipients.
| Enumerator | |
|---|---|
| JWE_FORMAT_COMPACT | RFC-7516 Sec 7.1 Compact Serialization (default) |
| JWE_FORMAT_JSON_FLAT | RFC-7516 Sec 7.2.2 Flattened JSON Serialization |
| JWE_FORMAT_JSON_GENERAL | RFC-7516 Sec 7.2.1 General JSON Serialization |
| enum jwk_thumbprint_alg_t |
Hash algorithm for a JWK Thumbprint and related digests.
Selects the digest used by jwks_item_thumbprint() / jwks_item_thumbprint_uri(), the embedded-JWK pin (jwt_checker_enable_embedded_jwk()), and jwt_token_hash(). SHA-256 is the value 0, so it is the default for a zero-initialized argument and is what virtually all deployments use.
| Enumerator | |
|---|---|
| JWK_THUMBPRINT_SHA256 | SHA-256 (default) |
| JWK_THUMBPRINT_SHA384 | SHA-384 |
| JWK_THUMBPRINT_SHA512 | SHA-512 |
| enum jwt_alg_t |
JWT algorithm types.
These are the supported algorithm types for LibJWT.
| const char * jwe_alg_str | ( | jwe_key_alg_t | alg | ) |
Convert a JWE key management alg type to its string representation.
| alg | A valid jwe_key_alg_t specifier. |
| const char * jwe_enc_str | ( | jwe_enc_t | enc | ) |
Convert a JWE content encryption enc type to its string representation.
| enc | A valid jwe_enc_t specifier. |
| jwe_key_alg_t jwe_str_alg | ( | const char * | alg | ) |
Convert a JWE key management alg string to type.
| alg | A valid string for a JWE key management algorithm (e.g. "A128KW"). |
| jwe_enc_t jwe_str_enc | ( | const char * | enc | ) |
Convert a JWE content encryption enc string to type.
| enc | A valid string for a JWE content encryption algorithm (e.g. "A256GCM"). |
| 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. On the token that jwt_checker_verified_jwt() returns, this is the algorithm its signature verified with, or JWT_ALG_INVAL for a General JWS JSON Serialization (see there).
| jwt | Pointer to a JWT object. |
| 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 for algorithm type (e.g. "RS256"). |