Interface JWE


public interface 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
 
Since:
V5.7
See Also:
JWTManager.parseJWE(String, javax.crypto.SecretKey)
  • Method Summary

    Modifier and Type Method Description
    JWEHeader getHeader()
    Returns the header for the JWS
    java.lang.String getPayload()  
    JWT getPlainJWT()
    Returns the Payload of the JWE as a JWT Object
  • Method Details

    • getPayload

      java.lang.String getPayload() throws com.ebasetech.ufs.runtime.security.jwt.InvalidJWTokenException
      Returns:
      payload as a string.
      Throws:
      com.ebasetech.ufs.runtime.security.jwt.InvalidJWTokenException - thrown if the payload is invalid
      Since:
      V5.7
    • getHeader

      JWEHeader getHeader() throws com.ebasetech.ufs.runtime.security.jwt.InvalidJWTokenException
      Returns the header for the JWS
      Returns:
      header for the JWS
      Throws:
      com.ebasetech.ufs.runtime.security.jwt.InvalidJWTokenException - thrown if the header is invalid
      Since:
      V5.7
    • getPlainJWT

      JWT getPlainJWT() throws com.ebasetech.ufs.runtime.security.jwt.InvalidJWTokenException
      Returns the Payload of the JWE as a JWT Object
      Returns:
      the decrypted JWE as PlainJWT token
      Throws:
      com.ebasetech.ufs.runtime.security.jwt.InvalidJWTokenException - thrown payload is invalid
      Since:
      V5.7