liveBook · Manning

JWE header

As explained in Software Security for Developers

JWEHeader is a Nimbus Java class representing the header of a JSON Web Encryption object.

A JWE header carries the metadata needed to process encrypted content. It identifies encryption choices such as the key-management algorithm and content-encryption method; together, alg and enc can provide enough information to decrypt the JWE. section 11.5.1

In Nimbus, JWEHeader is the Java representation of that header. A builder can select JWEAlgorithm.DIR, EncryptionMethod.A256GCM, and content type application/json before combining the header with a payload. section 11.5.2

Nimbus header construction

JWEHeader header = new JWEHeader.Builder(JWEAlgorithm.DIR, EncryptionMethod.A256GCM).contentType("application/json").build(); The resulting header is placed in a JWEObject, which Nimbus can encrypt and serialize.

How Software Security for Developers covers it

How deep it goes
Explains header fields and Nimbus construction, but defers detailed cryptographic implementation to the library.
Examples
Uses a decoded alg/enc JSON header and a Nimbus builder selecting DIR, A256GCM, and application/json.
What it assumes
Assumes basic Java familiarity while introducing JWE structure, payloads, algorithms, and Nimbus abstractions.
What you can do after
Builds a JWE header with Nimbus and attaches it to an encryptable JWEObject.
How it connects
Connects JWE headers with JWE, JOSE, AES-GCM, JWEObject, and DirectEncrypter.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Security for Developers. The section links point to the parts of the book it draws on.