JSON Web Encryption (JWE)
JSON Web Encryption (JWE) is the IETF standard, RFC 7516, for encrypting a JSON payload so only the intended recipient can read it.
JSON Web Token (JWT) and JAdES show two ways of proving a JSON payload has not been altered - signing it. JSON Web Encryption (JWE) does the opposite job: it hides the payload itself, so that only the intended recipient can read it. Where a signed token lets anyone with the public key verify it, an encrypted token lets no one without the right private key even see it.
A JWE works in two layers. A one-off, randomly generated content encryption key (CEK) encrypts the actual payload with a symmetric algorithm such as AES; the CEK itself is then encrypted with the recipient's public key, using an algorithm such as RSA or elliptic curve cryptography. Only the holder of the matching private key can recover the CEK and, with it, the payload.
The result is a JSON object with five parts: a header describing the algorithms used, the encrypted CEK, an initialization vector, the ciphertext and an authentication tag. In its compact serialization these five parts are base64url-encoded and joined with dots into a single string - the encrypted counterpart to a JWT's three-part structure. JWE is defined by the IETF in RFC 7516, published alongside the related JSON Web Signature (JWS) and JSON Web Algorithms (JWA) specifications as part of the JOSE (JSON Object Signing and Encryption) framework.