Module Jose.Jwa

JSON Web Algorithm

Link to RFC

type alg = [
  1. | `RS256
    (*

    RSASSA-PKCS1-v1_5 using SHA-256 - Recommended (RFC 7518 §3.1)

    *)
  2. | `HS256
    (*

    HMAC using SHA-256 - Required (RFC 7518 §3.1)

    *)
  3. | `ES256
    (*

    ECDSA using P-256 and SHA-256 - Recommended+ (RFC 7518 §3.1)

    *)
  4. | `ES384
    (*

    ECDSA using P-384 and SHA-384 - Optional (RFC 7518 §3.1)

    *)
  5. | `ES512
    (*

    ECDSA using P-521 and SHA-512 - Optional (RFC 7518 §3.1)

    *)
  6. | `EdDSA
    (*

    EdDSA signature algorithm - Optional Link to RFC 8037 §3.1

    *)
  7. | `Ed25519
    (*

    Ed25519 signature algorithm - Fully-specified replacement for EdDSA Link to RFC 9864 §3.1

    *)
  8. | `RSA_OAEP
    (*

    RSAES OAEP using default parameters - Recommended+ (RFC 7518 §4.1)

    *)
  9. | `RSA1_5
    (*

    RSA PKCS 1 v1.5 - Recommended- (RFC 7518 §4.1)

    *)
  10. | `Dir
    (*

    Direct use of a shared symmetric key - Recommended (RFC 7518 §4.1)

    *)
  11. | `A128KW
    (*

    AES Key Wrap using 128-bit key - Recommended (RFC 7518 §4.1, RFC 3394)

    *)
  12. | `A256KW
    (*

    AES Key Wrap using 256-bit key - Recommended (RFC 7518 §4.1, RFC 3394)

    *)
  13. | `ECDH_ES
    (*

    Elliptic Curve Diffie-Hellman Ephemeral Static key agreement using Concat KDF - Recommended+ (RFC 7518 §4.1, §4.6)

    *)
  14. | `ECDH_ES_A128KW
    (*

    ECDH-ES using Concat KDF and CEK wrapped with "A128KW" - Recommended (RFC 7518 §4.1, §4.6)

    *)
  15. | `ECDH_ES_A256KW
    (*

    ECDH-ES using Concat KDF and CEK wrapped with "A256KW" - Recommended (RFC 7518 §4.6, §4.6)

    *)
  16. | `None
    (*

    No digital signature or MAC performed - Optional (RFC 7518 §3.1)

    *)
  17. | `Unsupported of string
]

Link to RFC 7518 §3.1

val alg_to_string : alg -> string
val alg_of_string : string -> alg
val alg_to_json : alg -> Yojson.Safe.t
val alg_of_json : Yojson.Safe.t -> alg
type use = [
  1. | `Sig
    (*

    Key used for digital signature or MAC (RFC 7517 §4.2)

    *)
  2. | `Enc
    (*

    Key used for encrypting data (RFC 7517 §4.2)

    *)
  3. | `Unsupported of string
]
val use_to_string : use -> string
val use_of_string : string -> use
val use_of_alg : alg -> use option
type kty = [
  1. | `oct
    (*

    Octet sequence (used to represent symmetric keys) - Required (RFC 7518 §6.1)

    *)
  2. | `RSA
    (*

    RSA - Required (RFC 7518 §6.1, RFC 3447)

    *)
  3. | `EC
    (*

    Elliptic Curve - Recommended+ (RFC 7518 §6.1)

    *)
  4. | `OKP
    (*

    Octet Key Pair - Optional Link to RFC 8037 §2

    *)
  5. | `Unsupported of string
]
val kty_to_string : kty -> string
val kty_of_string : string -> kty
type enc = [
  1. | `A128CBC_HS256
    (*

    AES_128_CBC_HMAC_SHA_256 authenticated encryption algorithm - Required (RFC 7518 §5.1, §5.2.3) https://tools.ietf.org/html/rfc7518#section-5.2.3

    *)
  2. | `A256CBC_HS512
    (*

    AES_256_CBC_HMAC_SHA_512 authenticated encryption algorithm - Required (RFC 7518 §5.1, §5.2.5) https://tools.ietf.org/html/rfc7518#section-5.2.5

    *)
  3. | `A128GCM
    (*

    AES GCM using 128-bit key - Recommended (RFC 7518 §5.1, §5.3)

    *)
  4. | `A256GCM
    (*

    AES GCM using 256-bit key - Recommended (RFC 7518 §5.1, §5.3)

    *)
]

Content Encryption Algorithms for JWE (RFC 7518 §5.1)

val enc_to_string : enc -> string
val enc_of_string : string -> enc