Class JWK

Direct Known Subclasses:
EcJWK, OctJWK, RsaJWK

public abstract class JWK extends JWObject
The abstract base class for the 3 implementations of JWK.
  • Field Details

  • Constructor Details

    • JWK

      protected JWK(KeyType kty, KeyUse use, String alg, String kid)
      Creates a JWK given the basic parameters.
      Parameters:
      kty - the JWK key type
      use - the JWK use
      alg - the JWK algorithm
      kid - the JWK key id
    • JWK

      protected JWK(KeyType kty, KeyUse use, String alg, String kid, String x5u, String x5t, List<String> x5c)
      Creates a JWK given the basic parameters.
      Parameters:
      kty - the JWK key type
      use - the JWK use
      alg - the JWK algorithm
      kid - the JWK key id
      x5u - the x509 url for the key
      x5t - the x509 thumbnail for the key
      x5c - the x509 chain as a list of Base64 encoded strings
  • Method Details

    • getKeyType

      public KeyType getKeyType()
      Gets the kty parameter of the JWK.
      Returns:
      A KeyType for the JWK
    • getUse

      public KeyUse getUse()
      Gets the use parameter of the JWK.
      Returns:
      A String representing the use parameter
    • getAlgorithm

      public String getAlgorithm()
      Gets the alg parameter of the JWK.
      Returns:
      A String representing the alg parameter
    • getKeyId

      public String getKeyId()
      Gets the kid parameter of the JWK.
      Returns:
      A String representing the kid parameter
    • toJsonString

      public String toJsonString()
      Prints the JWK Object as a json string.
      Returns:
      A String representing JWK
    • parse

      public static JWK parse(String json)
      Parses a String into the proper JWK type.
      Parameters:
      json - The json String.
      Returns:
      A JWK object
      Throws:
      JsonException - If there is a problem parsing the json String.
    • parse

      public static JWK parse(JsonValue jwk)
      Parses a JsonValue into the proper JWK type.
      Parameters:
      jwk - The JsonValue Object.
      Returns:
      A JWK object
      Throws:
      JsonException - If there is a problem parsing the json String.
    • toJsonValue

      protected static JsonValue toJsonValue(String json)
      Converts a String into a JsonValue.
      Parameters:
      json - The json String.
      Returns:
      A JsonValue object.
      Throws:
      JsonException - If there is a problem parsing the json String.
    • getX509URL

      public String getX509URL()
      Gets the X509 URL.
      Returns:
      the url of the 509 cert header or null
    • getX509Thumbnail

      Gets the X509 thumbnail.
      Returns:
      Base64url of the X509 thumbnail
    • getX509Chain

      Gets a List of X509 chain certs.
      Returns:
      X509 Cert Chain as list of encoded strings or null if none are available.