Interface JWEService

All Superinterfaces:
JOSEObjectService

public interface JWEService extends JOSEObjectService

The JWE Service is the main entry point for creating and reading JSON Web Encryption objects.

It allows to fluently create JWE objects using JWEBuilder for compact serialization or JsonJWEBuilder for JSON serialization. It also exposes JWEReader and JsonJWEReader to read JWE compact representation or JWE JSON representation respectively.

Please refer to RFC7516 Section 7.1 for compact serialization and to RFC7516 Section 7.2 for JSON serialization.

Since:
1.5
Author:
Jeremy Kuhn
  • Method Summary

    Modifier and Type
    Method
    Description
    default <T> JWEBuilder<T,?,?>
    Returns a new JOSE object builder.
    default <T> JWEBuilder<T,?,?>
    builder(Class<T> type)
    Returns a new JOSE object builder with the specified payload type.
    default <T> JWEBuilder<T,?,?>
    builder(Class<T> type, Publisher<? extends JWK> keys)
    Returns a new JOSE object builder with the specified payload type and using the specified keys.
    default <T> JWEBuilder<T,?,?>
    builder(Type type)
    Returns a new JOSE object builder with the specified payload type.
    <T> JWEBuilder<T,?,?>
    builder(Type type, Publisher<? extends JWK> keys)
    Returns a new JOSE object builder with the specified payload type and using the specified keys.
    default <T> JWEBuilder<T,?,?>
    builder(Publisher<? extends JWK> keys)
    Returns a new JOSE object builder using the specified keys.
    default <T> JsonJWEBuilder<T,?,?>
    Returns a new JSON JOSE object builder.
    default <T> JsonJWEBuilder<T,?,?>
    jsonBuilder(Class<T> type)
    Returns a new JSON JOSE object builder with the specified payload type.
    <T> JsonJWEBuilder<T,?,?>
    Returns a new JSON JOSE object builder with the specified payload type.
    default <T> JsonJWEReader<T,?>
    jsonReader(Class<T> type)
    Returns a new JSON JOSE object reader with the specified payload type.
    <T> JsonJWEReader<T,?>
    Returns a new JSON JOSE object reader with the specified payload type.
    default <T> JWEReader<T,?>
    reader(Class<T> type)
    Returns a new JOSE object reader with the specified payload type.
    default <T> JWEReader<T,?>
    reader(Class<T> type, Publisher<? extends JWK> keys)
    Returns a new JOSE object reader with the specified payload type and using the specified keys.
    default <T> JWEReader<T,?>
    reader(Type type)
    Returns a new JOSE object reader with the specified payload type.
    <T> JWEReader<T,?>
    reader(Type type, Publisher<? extends JWK> keys)
    Returns a new JOSE object reader with the specified payload type and using the specified keys.
  • Method Details

    • builder

      default <T> JWEBuilder<T,?,?> builder()
      Description copied from interface: JOSEObjectService

      Returns a new JOSE object builder.

      The returned builder will try to resolve the JWK to use to secure the JOSE object based on the JOSE header. It will fail if it wasn't able to find a suitable key.

      Specified by:
      builder in interface JOSEObjectService
      Type Parameters:
      T - the payload type
      Returns:
      a new JOSE object builder
    • builder

      default <T> JWEBuilder<T,?,?> builder(Class<T> type)
      Description copied from interface: JOSEObjectService

      Returns a new JOSE object builder with the specified payload type.

      The returned builder will try to resolve the JWK to use to secure the JOSE object based on the JOSE header. It will fail if it wasn't able to find a suitable key.

      Specified by:
      builder in interface JOSEObjectService
      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      Returns:
      a new JOSE object builder
    • builder

      default <T> JWEBuilder<T,?,?> builder(Type type)
      Description copied from interface: JOSEObjectService

      Returns a new JOSE object builder with the specified payload type.

      The returned builder will try to resolve the JWK to use to secure the JOSE object based on the JOSE header. It will fail if it wasn't able to find a suitable key.

      Specified by:
      builder in interface JOSEObjectService
      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      Returns:
      a new JOSE object builder
    • builder

      default <T> JWEBuilder<T,?,?> builder(Publisher<? extends JWK> keys)
      Description copied from interface: JOSEObjectService

      Returns a new JOSE object builder using the specified keys.

      The returned builder will use the specified keys to secure the JOSE object, the first succeeding key will be retained and remaining keys will be ignored. It will fail if no suitable key have been specified or if they are not consistent with the JOSE header.

      Specified by:
      builder in interface JOSEObjectService
      Type Parameters:
      T - the payload type
      Parameters:
      keys - the keys to consider to secure the JOSE object
      Returns:
      a new JOSE object builder
    • builder

      default <T> JWEBuilder<T,?,?> builder(Class<T> type, Publisher<? extends JWK> keys)
      Description copied from interface: JOSEObjectService

      Returns a new JOSE object builder with the specified payload type and using the specified keys.

      The returned builder will use the specified keys to secure the JOSE object, the first succeeding key will be retained and remaining keys will be ignored. It will fail if no suitable key have been specified or if they are not consistent with the JOSE header.

      Specified by:
      builder in interface JOSEObjectService
      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      keys - the keys to consider to secure the JOSE object
      Returns:
      a new JOSE object builder
    • builder

      <T> JWEBuilder<T,?,?> builder(Type type, Publisher<? extends JWK> keys)
      Description copied from interface: JOSEObjectService

      Returns a new JOSE object builder with the specified payload type and using the specified keys.

      The returned builder will use the specified keys to secure the JOSE object, the first succeeding key will be retained and remaining keys will be ignored. It will fail if no suitable key have been specified or if they are not consistent with the JOSE header.

      Specified by:
      builder in interface JOSEObjectService
      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      keys - the keys to consider to secure the JOSE object
      Returns:
      a new JOSE object builder
    • reader

      default <T> JWEReader<T,?> reader(Class<T> type)
      Description copied from interface: JOSEObjectService

      Returns a new JOSE object reader with the specified payload type.

      The returned reader will try to resolve the public JWK that corresponds to the key used to secure the JOSE object based on the JOSE header. It will fail if it wasn't able to find a suitable key.

      Specified by:
      reader in interface JOSEObjectService
      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      Returns:
      a new JOSE object reader
    • reader

      default <T> JWEReader<T,?> reader(Type type)
      Description copied from interface: JOSEObjectService

      Returns a new JOSE object reader with the specified payload type.

      The returned reader will try to resolve the public JWK that corresponds to the key used to secure the JOSE object based on the JOSE header. It will fail if it wasn't able to find a suitable key.

      Specified by:
      reader in interface JOSEObjectService
      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      Returns:
      a new JOSE object reader
    • reader

      default <T> JWEReader<T,?> reader(Class<T> type, Publisher<? extends JWK> keys)
      Description copied from interface: JOSEObjectService

      Returns a new JOSE object reader with the specified payload type and using the specified keys.

      The returned reader will use the specified keys to verify or decrypt the JOSE object, the first succeeding key will be retained and remaining keys will be ignored. It will fail if no suitable key have been specified or if they are not consistent with the JOSE header.

      Specified by:
      reader in interface JOSEObjectService
      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      keys - the keys to consider to verify or decrypt the JOSE object
      Returns:
      a new JOSE object reader
    • reader

      <T> JWEReader<T,?> reader(Type type, Publisher<? extends JWK> keys)
      Description copied from interface: JOSEObjectService

      Returns a new JOSE object reader with the specified payload type and using the specified keys.

      The returned reader will use the specified keys to verify or decrypt the JOSE object, the first succeeding key will be retained and remaining keys will be ignored. It will fail if no suitable key have been specified or if they are not consistent with the JOSE header.

      Specified by:
      reader in interface JOSEObjectService
      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      keys - the keys to consider to verify or decrypt the JOSE object
      Returns:
      a new JOSE object reader
    • jsonBuilder

      default <T> JsonJWEBuilder<T,?,?> jsonBuilder()
      Description copied from interface: JOSEObjectService

      Returns a new JSON JOSE object builder.

      Specified by:
      jsonBuilder in interface JOSEObjectService
      Type Parameters:
      T - the payload type
      Returns:
      a new JSON JOSE object builder
    • jsonBuilder

      default <T> JsonJWEBuilder<T,?,?> jsonBuilder(Class<T> type)
      Description copied from interface: JOSEObjectService

      Returns a new JSON JOSE object builder with the specified payload type.

      Specified by:
      jsonBuilder in interface JOSEObjectService
      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      Returns:
      a new JSON JOSE object builder
    • jsonBuilder

      <T> JsonJWEBuilder<T,?,?> jsonBuilder(Type type)
      Description copied from interface: JOSEObjectService

      Returns a new JSON JOSE object builder with the specified payload type.

      Specified by:
      jsonBuilder in interface JOSEObjectService
      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      Returns:
      a new JSON JOSE object builder
    • jsonReader

      default <T> JsonJWEReader<T,?> jsonReader(Class<T> type)
      Description copied from interface: JOSEObjectService

      Returns a new JSON JOSE object reader with the specified payload type.

      Specified by:
      jsonReader in interface JOSEObjectService
      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      Returns:
      a new JSON JOSE object reader
    • jsonReader

      <T> JsonJWEReader<T,?> jsonReader(Type type)
      Description copied from interface: JOSEObjectService

      Returns a new JSON JOSE object reader with the specified payload type.

      Specified by:
      jsonReader in interface JOSEObjectService
      Type Parameters:
      T - the payload type
      Parameters:
      type - the payload type
      Returns:
      a new JSON JOSE object reader