Class JWS.Signature

java.lang.Object
de.christofreichardt.json.websignature.JWS.Signature
All Implemented Interfaces:
de.christofreichardt.diagnosis.Traceable, BeforeHeader, BeforeKid, BeforePayload, SignatureBegin, SignatureEnd
Enclosing class:
JWS

protected static class JWS.Signature extends Object implements SignatureBegin, BeforePayload, BeforeHeader, BeforeKid, SignatureEnd, de.christofreichardt.diagnosis.Traceable
Implements all interfaces of the Fluent API related to creating signatures.
Author:
Christof Reichardt
  • Constructor Details

    • Signature

      protected Signature()
  • Method Details

    • payload

      public SignatureEnd payload(jakarta.json.JsonStructure payload)
      Description copied from interface: BeforePayload
      Introduces the actual payload.
      Specified by:
      payload in interface BeforePayload
      Parameters:
      payload - the given payload
      Returns:
      the last step within the workflow of the Fluent API regarding the generation of signatures.
    • payload

      public SignatureEnd payload(String strPayload)
      Description copied from interface: BeforePayload
      Introduces the actual payload as string. The string must be valid JSON at present.
      Specified by:
      payload in interface BeforePayload
      Parameters:
      strPayload - the given payload.
      Returns:
      the last step within the workflow of the Fluent API regarding the generation of signatures.
    • webkey

      public BeforeHeader webkey(JsonWebKeyPair jsonWebKeyPair)
      Description copied from interface: SignatureBegin
      Notes the given JsonWebKeyPair. The private part will be used for generating the actual signature. The public part will be exposed within the JOSE header if you don't chose to explicitly hand over a JOSE header yourself within the next step.
      Specified by:
      webkey in interface SignatureBegin
      Parameters:
      jsonWebKeyPair - the given JsonWebKeyPair.
      Returns:
      the next stop within the workflow of the Fluent API regarding the generation of signatures.
    • webkey

      public BeforeHeader webkey(JsonWebSecretKey jsonWebSecretKey)
      Description copied from interface: SignatureBegin
      Notes the given JsonWebSecretKey. The wrapped secret key will be used for generating the signature.
      Specified by:
      webkey in interface SignatureBegin
      Parameters:
      jsonWebSecretKey - the given JsonWebSecretKey.
      Returns:
      the next stop within the workflow of the Fluent API regarding the generation of signatures.
    • key

      public BeforeHeader key(KeyPair keyPair)
      Description copied from interface: SignatureBegin
      The given KeyPair will be used to build a JsonWebKeyPair. The private part will be used for generating the actual signature. The public part will be exposed within the JOSE header if you don't chose to explicitly hand over a JOSE header yourself within the next step.
      Specified by:
      key in interface SignatureBegin
      Parameters:
      keyPair - the given KeyPair.
      Returns:
      the next stop within the workflow of the Fluent API regarding the generation of signatures.
    • key

      public BeforeHeader key(SecretKey secretKey)
      Description copied from interface: SignatureBegin
      The given SecretKey will be used to build a JsonWebSecretKey.
      Specified by:
      key in interface SignatureBegin
      Parameters:
      secretKey - the given SecretKey.
      Returns:
      the next stop within the workflow of the Fluent API regarding the generation of signatures.
    • sign

      Description copied from interface: SignatureEnd
      Uses the gathered information to create a JSON Web Signature.
      Specified by:
      sign in interface SignatureEnd
      Returns:
      a JWSCompactSerialization
      Throws:
      GeneralSecurityException - passed through from the underlying implementations of the algorithms by the JDK
    • sign

      Description copied from interface: SignatureEnd
      Uses the gathered information to create a JSON Web Signature. The provided Json2StringConverter is used to predictably format the JSON input prior to generating the signature.
      Specified by:
      sign in interface SignatureEnd
      Parameters:
      converter - the to be used Json2StringConverter
      Returns:
      a JWSCompactSerialization
      Throws:
      GeneralSecurityException - passed through from the underlying implementations of the algorithms by the JDK
    • kid

      public BeforePayload kid(String kid)
      Description copied from interface: BeforeKid
      Notes the given kid.
      Specified by:
      kid in interface BeforeKid
      Parameters:
      kid - the given kid.
      Returns:
      the next stop within the workflow of the Fluent API regarding the generation of signatures.
      See Also:
    • typ

      public BeforeKid typ(String typ)
      Description copied from interface: BeforeHeader
      Notes the given typ.
      Specified by:
      typ in interface BeforeHeader
      Parameters:
      typ - the given typ.
      Returns:
      the next stop within the workflow of the Fluent API regarding the generation of signatures.
      See Also:
    • header

      public BeforePayload header(String strHeader)
      Description copied from interface: BeforeHeader
      Notes the given explicit JOSE header. You are responsible for the correct representation of the JOSE header.
      Specified by:
      header in interface BeforeHeader
      Parameters:
      strHeader - the given explicit JOSE header.
      Returns:
      the next stop within the workflow of the Fluent API regarding the generation of signatures.
    • getCurrentTracer

      public de.christofreichardt.diagnosis.AbstractTracer getCurrentTracer()
      Specified by:
      getCurrentTracer in interface de.christofreichardt.diagnosis.Traceable