Class JWSSigner

java.lang.Object
org.webpki.jose.jws.JWSSigner
Direct Known Subclasses:
JWSAsymKeySigner, JWSHmacSigner

public abstract class JWSSigner extends Object
JWS encoder base class
  • Method Details

    • setProvider

      public JWSSigner setProvider(String provider)
      Set cryptographic provider.
      Parameters:
      provider - Name of provider like "BC"
      Returns:
      JwsSigner
    • setKeyId

      public JWSSigner setKeyId(String keyId)
      Adds "kid" to the JWS header.
      Parameters:
      keyId - The key identifier to be included.
      Returns:
      JwsSigner
    • addHeaderItems

      public JWSSigner addHeaderItems(JSONObjectReader items)
      Add header elements.
      Parameters:
      items - A set of JSON tokens
      Returns:
      JwsSigner
    • sign

      public JSONObjectWriter sign(JSONObjectWriter objectToBeSigned, String signatureProperty)
      Create JWS/CT object.
      Parameters:
      objectToBeSigned - The JSON object to be signed
      signatureProperty - Name of property holding the "detached" JWS
      Returns:
      The now signed objectToBeSigned
    • sign

      public String sign(byte[] jwsPayload, boolean detached)
      Create compact mode JWS object. Note that the detached mode follows the specification described in https://tools.ietf.org/html/rfc7515#appendix-F.
      Parameters:
      jwsPayload - Binary payload
      detached - True if payload is not to be supplied in the JWS string
      Returns:
      JWS compact (string)