JWE

JWE represents a parsed JWE (JSON Web Encryption) Object.

JWE represents encrypted content using JSON data structures and base64url encoding. The representation consists of three parts: the JWE Header, the JWE Encrypted Key, and the JWE Cipher text. The three parts are base64url-encoded for transmission, and typically represented as the concatenation of the encoded strings in that order, with the three strings being separated by period (".") characters.

Header Section

The header consist of information relating to:

  • The Content Encryption Key used to produced the JWE,
  • The encrypted algorithm used to produce the JWE cypher.
  • The X.509 certificate that corresponds to the key used to encrypt the JWE. This is base64 encoded.
An example header using A256GCM hashed secret key:
 {
   "enc": "A256GCM",
   "alg": "dir"
 }
 

Payload

The payload contains the data for the JWT. Using the JWTBuilder to generate a JWT object and
An example payload:

 {
  "iss": "https://server.ebasetech.com",
  "aud": "https://client.ebasetech.com",
  "name": "John Doe"
 }
 

The following show an example Base64url encoding the bytes of the UTF-8 representation of the JWE Header yields this Encoded JWE Header value:

 eyJlbmMiOiJBMjU2R0NNIiwiYWxnIjoiZGlyIn0..hcdXZsbP6P0Xr8QR.ND3QbFqwUOXoRl4KMjOMkYUoPGQBRK10KlZHjXSup94nQsyi-1xFYplsctFygbG9GvDTxouONQWUlxkTfl3YoI5rqTPeNU4SoRQyPMCRpDBZQLWqfWlEd8lIDCynFxMt1xLYbmROS8XiFOkDdnY6vtoy7sVu.Xt9BZQazg6MlhNjK26UvCQ
 

JWE Functions

getHeader JWE.getHeader( ) Returns the header for the JWS
getPayload JWE.getPayload( )
getPlainJWT JWE.getPlainJWT( ) Returns the Payload of the JWE as a JWT Object