blob: 08fdedbe7f769a304a911099a223126f2b307632 [file] [edit]
.\" Automatically generated by Pandoc 3.9.0.2
.\"
.TH "JWE\-DECRYPT" "1" "" "jwe\-decrypt User Manual" "LibJWT C Library"
.SH NAME
\f[B]jwe\-decrypt\f[R] \- Decrypt and authenticate a JSON Web Encryption
(JWE) token
.SH SYNOPSIS
.PP
\f[B]jwe\-decrypt\f[R] \f[B]\-k\f[R] \f[I]KEY\f[R] \f[B]\-a\f[R]
\f[I]ALG\f[R] \f[B]\-e\f[R] \f[I]ENC\f[R] \f[B][options]\f[R]
\f[B][TOKEN]\f[R]
.SH DESCRIPTION
\f[B]jwe\-decrypt\f[R] parses a JWE token, recovers the Content
Encryption Key, and decrypts and authenticates the content.
The serialization is detected automatically: a token beginning with
\f[B]{\f[R] is parsed as a JSON Serialization (Flattened or General),
otherwise as the Compact Serialization.
.PP
The key is supplied as a JSON Web Key with \f[B]\-k\f[R].
The expected key management algorithm (\f[B]\-a\f[R]) and content
encryption algorithm (\f[B]\-e\f[R]) act as an allow\-list: a token
whose header does not match the configured pair is rejected.
This prevents a token from selecting an unexpected algorithm.
For a General JSON token with several recipients, the recipient whose
algorithm matches \f[B]\-a\f[R] and whose key is \f[B]\-k\f[R] is
selected.
.PP
The token may be given as the final argument or, if omitted, read from
standard input.
On success the decrypted plaintext is written to standard output.
On any failure the program prints an error and exits non\-zero.
.SH OPTIONS
.TP
\-h, \-\-help
Show help and exit.
.TP
\-k, \-\-key=\f[I]FILE\f[R]
File containing the JSON Web Key used to recover the CEK.
Required.
.TP
\-a, \-\-algorithm=\f[I]ALG\f[R]
The expected JWE key management algorithm.
Required.
.TP
\-e, \-\-enc=\f[I]ENC\f[R]
The expected JWE content encryption algorithm.
Required.
.SH NOTES
A failure to recover the CEK (a wrong key, bad RSA padding, or a
corrupted wrapped key) is not distinguished from a failed content
authentication tag: per RFC 7516, the decrypter substitutes a random CEK
and fails uniformly at the tag, denying a padding oracle.
A General JSON token in which no recipient matches the configured
algorithm and key fails with the same generic error.
.SH SEE ALSO
jwe\-encrypt(1), key2jwk(1), jwt\-verify(1)