Bounded compact JWE encryption for credential issuance and presentation.
Supports ECDH-ES with a P-256 recipient key and A128GCM or A256GCM. Callers
select the algorithms from authenticated protocol metadata and may narrow
them with :accepted_algs and :accepted_encs. This module performs no
network access or protocol-specific claim validation.
Input and plaintext limits default to 1 MiB. :max_compact_bytes and
:max_plaintext_bytes may explicitly override them. Protected headers are
limited to 16 KiB. Compression, critical extensions, duplicate JSON members,
noncanonical Base64URL, and invalid fixed-length GCM parameters are rejected
before decryption.
Summary
Functions
Authenticate and decrypt a compact JWE, returning its protected header.
Encrypt bytes to a recipient using an authenticated protected header.
Encrypt locally produced plaintext with outbound-only RFC 7516 DEFLATE
compression. The caller's header must omit zip; this function supplies
zip: "DEF" and JOSE compresses the bounded plaintext before encryption.
Plaintext limits apply before compression. decrypt/3 still refuses zip
before handing ciphertext to JOSE, and never inflates received input.
Split a compact JWE and decode its protected header without decrypting it, enforcing core's 16384-byte protected-header limit.
Types
@type error() ::
:invalid_jwe | :invalid_key | :invalid_header | :invalid_options | :size_limit
@type key() :: JOSE.JWK.t() | map()
Functions
Authenticate and decrypt a compact JWE, returning its protected header.
The recipient must include private key material. All compact and protected header checks run before JOSE processes the ciphertext.
Encrypt bytes to a recipient using an authenticated protected header.
The header must include alg and enc. JOSE generates a fresh ephemeral
key; callers cannot supply epk. Private recipient keys are reduced to
their public part before encryption.
Encrypt locally produced plaintext with outbound-only RFC 7516 DEFLATE
compression. The caller's header must omit zip; this function supplies
zip: "DEF" and JOSE compresses the bounded plaintext before encryption.
Plaintext limits apply before compression. decrypt/3 still refuses zip
before handing ciphertext to JOSE, and never inflates received input.
Split a compact JWE and decode its protected header without decrypting it, enforcing core's 16384-byte protected-header limit.