Class JWSSigner

java.lang.Object
de.christofreichardt.json.websignature.JWSBase
de.christofreichardt.json.websignature.JWSSigner
All Implemented Interfaces:
de.christofreichardt.diagnosis.Traceable

public class JWSSigner extends JWSBase implements de.christofreichardt.diagnosis.Traceable
Low level class for the creating JSON web signatures. Subject to change. The preferred entry point is the Fluent API.
Author:
Christof Reichardt
See Also:
  • Constructor Details

    • JWSSigner

      public JWSSigner(jakarta.json.JsonObject joseHeader, jakarta.json.JsonStructure payload)
      Creates a JWSSigner with the specified JOSE header and JSON payload. Delegates to JWSSigner(JsonObject, JsonStructure, Json2StringConverter) by passing JsonValue.toString() as Json2StringConverter.
      Parameters:
      joseHeader - the JOSE header
      payload - the JSON payload
    • JWSSigner

      public JWSSigner(jakarta.json.JsonObject joseHeader, jakarta.json.JsonStructure payload, Json2StringConverter converter)
      Creates a JWSSigner with the specified JOSE header and JSON payload.
      Parameters:
      joseHeader - the JOSE header
      payload - the JSON payload
      converter - the to be used Json2StringConverter
    • JWSSigner

      public JWSSigner(String strJoseHeader, String strPayload)
      Creates a JWSSigner with the specified literal JOSE header and literal JSON payload as signing input (no conversion).
      Parameters:
      strJoseHeader - the JOSE header
      strPayload - the JSON payload
  • Method Details

    • sign

      public JWSCompactSerialization sign(Key signingKey) throws GeneralSecurityException
      Generates the JSON web signature as compact serialization. In the event of assymetric algorithms (indicated by the JOSE header) this MUST be a PrivateKey whereas symmetric algorithms require a SecretKey.
      Parameters:
      signingKey - the to used Key
      Returns:
      the JSON web signature as compact serialization
      Throws:
      GeneralSecurityException - indicates that a problem occured during the signing process
    • getCurrentTracer

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