Class JSONWebKey

java.lang.Object
io.fusionauth.jwks.domain.JSONWebKey
All Implemented Interfaces:
Buildable<JSONWebKey>

public class JSONWebKey extends Object implements Buildable<JSONWebKey>
Author:
Daniel DeGroff
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The "alg" parameter identifies the algorithm intended for use with this key.
    The name of the Elliptic curve.
    The "d" parameter contains the private exponent value for the RSA private key as described in RFC 7518 Section 6.3.2.1 It is represented as a Base64urlUInt-encoded value.
    The "dp" parameter contains the first factor CRT (Chinese Remainder Theorem) exponent factor for the RSA private key.
    The "dq" parameter contains the second factor CRT (Chinese Remainder Theorem) exponent factor for the RSA private key.
    The "e" parameter contains the public exponent value for the RSA public key.
    The key identifier.
    The key type parameter.
    The "n" parameter contains the modulus value for the RSA public key.
    This Map will contain all the properties that aren't specifically defined in this class.
    The "p" parameter contains the first prime factor for the RSA private key.
    The "q" parameter contains the second prime factor for the RSA private key.
    The "qi" parameter contains the first CRT (Chinese Remainder Theorem) coefficient factor for the RSA private key.
    The "use" parameter identifies the intended use of the public key.
    The "x" parameter is the x coordinate of the Elliptic Curve
    The "x5c" parameter contains the encoded X509 certificate chain.
    The x.509 SHA-1 certificate thumbprint.
    The x.509 SHA-256 certificate thumbprint.
    The "y" parameter is the y coordinate of the Elliptic Curve
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    add(String key, Object value)
     
    static JSONWebKey
    build(String encodedPEM)
    Build a JSON Web Key from an encoded PEM.
    static JSONWebKey
    build(Certificate certificate)
    Build a JSON Web Key from a certificate
    static JSONWebKey
    build(PrivateKey privateKey)
    Build a JSON Web Key from a private key
    static JSONWebKey
    build(PublicKey publicKey)
    Build a JSON Web Key from a public key
    boolean
     
     
    int
     
    static PublicKey
    Build a public key from a JSON Web Key containing a public RSA or EC key.
     
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.fusionauth.domain.Buildable

    with
  • Field Details

    • alg

      public Algorithm alg
      The "alg" parameter identifies the algorithm intended for use with this key.
    • crv

      public String crv
      The name of the Elliptic curve.
      • P-256
      • P-384
      • P-521
    • d

      public String d
      The "d" parameter contains the private exponent value for the RSA private key as described in RFC 7518 Section 6.3.2.1 It is represented as a Base64urlUInt-encoded value.

      The "d" parameter contains the private key for an ECC Private Key as described in RFC 7518 Section 6.2.2.1

    • dp

      public String dp
      The "dp" parameter contains the first factor CRT (Chinese Remainder Theorem) exponent factor for the RSA private key. It is represented as a Base64urlUInt-encoded value.
    • dq

      public String dq
      The "dq" parameter contains the second factor CRT (Chinese Remainder Theorem) exponent factor for the RSA private key. It is represented as a Base64urlUInt-encoded value.
    • e

      public String e
      The "e" parameter contains the public exponent value for the RSA public key. It is represented as a Base64urlUInt-encoded value.
    • kid

      public String kid
      The key identifier. This value can be used to match up the correct key to verify a JWT signature based upon the 'kid' found in the JWT header.
    • kty

      public KeyType kty
      The key type parameter.
      • EC : Elliptic Curve
      • RSA : RSA
      • oct : Octet sequence (used to represent symmetric keys)
    • n

      public String n
      The "n" parameter contains the modulus value for the RSA public key. It is represented as a Base64urlUInt-encoded value.
    • other

      public Map<String,Object> other
      This Map will contain all the properties that aren't specifically defined in this class.
    • p

      public String p
      The "p" parameter contains the first prime factor for the RSA private key. It is represented as a Base64urlUInt-encoded value.
    • q

      public String q
      The "q" parameter contains the second prime factor for the RSA private key. It is represented as a Base64urlUInt-encoded value.
    • qi

      public String qi
      The "qi" parameter contains the first CRT (Chinese Remainder Theorem) coefficient factor for the RSA private key. It is represented as a Base64urlUInt-encoded value.
    • use

      public String use
      The "use" parameter identifies the intended use of the public key.
      • sig : signature
      • enc : encryption
    • x

      public String x
      The "x" parameter is the x coordinate of the Elliptic Curve
    • x5c

      public List<String> x5c
      The "x5c" parameter contains the encoded X509 certificate chain.
    • x5t

      public String x5t
      The x.509 SHA-1 certificate thumbprint.
    • x5t_256

      public String x5t_256
      The x.509 SHA-256 certificate thumbprint.
    • y

      public String y
      The "y" parameter is the y coordinate of the Elliptic Curve
  • Constructor Details

    • JSONWebKey

      public JSONWebKey()
  • Method Details

    • build

      public static JSONWebKey build(String encodedPEM)
      Build a JSON Web Key from an encoded PEM.
      Parameters:
      encodedPEM - an encoded PEM
      Returns:
      a JSON Web Key
    • parse

      public static PublicKey parse(JSONWebKey key)
      Build a public key from a JSON Web Key containing a public RSA or EC key.
      Parameters:
      key - a JSON web key containing a public key
      Returns:
      a public key
    • build

      public static JSONWebKey build(Certificate certificate)
      Build a JSON Web Key from a certificate
      Parameters:
      certificate - the certificate
      Returns:
      a JSON Web Key
    • build

      public static JSONWebKey build(PrivateKey privateKey)
      Build a JSON Web Key from a private key
      Parameters:
      privateKey - a private key
      Returns:
      a JSON Web Key
    • build

      public static JSONWebKey build(PublicKey publicKey)
      Build a JSON Web Key from a public key
      Parameters:
      publicKey - a public key
      Returns:
      a JSON Web Key
    • add

      public JSONWebKey add(String key, Object value)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • getOther

      public Map<String,Object> getOther()
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toJSON

      public String toJSON()
    • toString

      public String toString()
      Overrides:
      toString in class Object