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.
