Enum JWSSerializationType

java.lang.Object
java.lang.Enum<JWSSerializationType>
eu.europa.esig.dss.enumerations.JWSSerializationType
All Implemented Interfaces:
Serializable, Comparable<JWSSerializationType>

public enum JWSSerializationType extends Enum<JWSSerializationType>
Represents JWS types defined in RFC 7515, 3. JSON Web Signature (JWS) Overview
  • Enum Constant Details

    • COMPACT_SERIALIZATION

      public static final JWSSerializationType COMPACT_SERIALIZATION
      3.1. JWS Compact Serialization Overview In the JWS Compact Serialization, no JWS Unprotected Header is used. In this case, the JOSE Header and the JWS Protected Header are the same. In the JWS Compact Serialization, a JWS is represented as the concatenation: BASE64URL(UTF8(JWS Protected Header)) || '.' || BASE64URL(JWS Payload) || '.' || BASE64URL(JWS Signature)
    • JSON_SERIALIZATION

      public static final JWSSerializationType JSON_SERIALIZATION
      7.2.1. General JWS JSON Serialization Syntax The following members are defined for use in top-level JSON objects used for the fully general JWS JSON Serialization syntax: payload The "payload" member MUST be present and contain the value BASE64URL(JWS Payload). signatures The "signatures" member value MUST be an array of JSON objects. Each object represents a signature or MAC over the JWS Payload and the JWS Protected Header. The following members are defined for use in the JSON objects that are elements of the "signatures" array: protected The "protected" member MUST be present and contain the value BASE64URL(UTF8(JWS Protected Header)) when the JWS Protected Header value is non-empty; otherwise, it MUST be absent. These Header Parameter values are integrity protected. header The "header" member MUST be present and contain the value JWS Unprotected Header when the JWS Unprotected Header value is non- empty; otherwise, it MUST be absent. This value is represented as an unencoded JSON object, rather than as a string. These Header Parameter values are not integrity protected. signature The "signature" member MUST be present and contain the value BASE64URL(JWS Signature). In summary, the syntax of a JWS using the general JWS JSON Serialization is as follows: { "payload":"<payload contents>", "signatures":[ {"protected":"<integrity-protected header 1 contents>", "header":<non-integrity-protected header 1 contents>, "signature":"<signature 1 contents>"}, ... {"protected":"<integrity-protected header N contents>", "header":<non-integrity-protected header N contents>, "signature":"<signature N contents>"}] }
    • FLATTENED_JSON_SERIALIZATION

      public static final JWSSerializationType FLATTENED_JSON_SERIALIZATION
      7.2.2. Flattened JWS JSON Serialization Syntax The flattened JWS JSON Serialization syntax is based upon the general syntax but flattens it, optimizing it for the single digital signature/MAC case. It flattens it by removing the "signatures" member and instead placing those members defined for use in the "signatures" array (the "protected", "header", and "signature" members) in the top-level JSON object (at the same level as the "payload" member). The "signatures" member MUST NOT be present when using this syntax. Other than this syntax difference, JWS JSON Serialization objects using the flattened syntax are processed identically to those using the general syntax. In summary, the syntax of a JWS using the flattened JWS JSON Serialization is as follows: { "payload":"<payload contents>", "protected":"<integrity-protected header contents>", "header":<non-integrity-protected header contents>, "signature":"<signature contents>" }
  • Method Details

    • values

      public static JWSSerializationType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static JWSSerializationType valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null