Class RsaJWK

java.lang.Object
org.forgerock.json.jose.jwk.JWK
org.forgerock.json.jose.jwk.RsaJWK

public class RsaJWK extends JWK
Implements a RsaJWK.
  • Constructor Details

    • RsaJWK

      @Deprecated public RsaJWK(String use, String alg, String kid, String modulus, String publicExponent, String x5u, String x5t, List<String> x5c)
      Deprecated.
      Use the builder instead.
      Creates a RsaJWK.
      Parameters:
      use - the use of the JWK
      alg - the alg of the JWK
      kid - the key id of the JWK
      modulus - the modulus of the JWK
      publicExponent - the public exponent JWK
      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
    • RsaJWK

      @Deprecated public RsaJWK(String use, String alg, String kid, String modulus, String publicExponent, String privateExponent, String x5u, String x5t, List<String> x5c)
      Deprecated.
      Use the builder instead.
      Creates a RsaJWK.
      Parameters:
      use - the use of the JWK
      alg - the alg of the JWK
      kid - the key id of the JWK
      modulus - the modulus of the JWK
      publicExponent - the public exponent JWK
      privateExponent - the private exponent JWK
      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
    • RsaJWK

      @Deprecated public RsaJWK(String use, String alg, String kid, String modulus, String publicExponent, String primeP, String primeQ, String primePExponent, String primeQExponent, String crtCoefficient, String x5u, String x5t, List<String> x5c)
      Deprecated.
      Use the builder instead.
      Creates a RsaJWK.
      Parameters:
      use - the use of the JWK
      alg - the alg of the JWK
      kid - the key id of the JWK
      modulus - the modulus of the JWK
      publicExponent - the public exponent JWK
      primeP - the first prime factor of the JWK
      primeQ - the second prime factor of the JWK
      primePExponent - the first factor exponent of the JWK
      primeQExponent - the second factor exponent of the JWK
      crtCoefficient - the first CRT Coefficient of the JWK
      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
    • RsaJWK

      @Deprecated public RsaJWK(String use, String alg, String kid, String modulus, String publicExponent, String privateExponent, String primeP, String primeQ, String primePExponent, String primeQExponent, String crtCoefficient, List<RsaJWK.PrimesInfo> otherPrimesInfo, String x5u, String x5t, List<String> x5c)
      Deprecated.
      Use the builder instead.
      Creates a RsaJWK.
      Parameters:
      use - the use of the JWK
      alg - the alg of the JWK
      kid - the key id of the JWK
      modulus - the modulus of the JWK
      publicExponent - the public exponent JWK
      privateExponent - the private exponent JWK
      primeP - the first prime factor of the JWK
      primeQ - the second prime factor of the JWK
      primePExponent - the first factor exponent of the JWK
      primeQExponent - the second factor exponent of the JWK
      crtCoefficient - the first CRT Coefficient of the JWK
      otherPrimesInfo - the extra factors of the JWK
      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
    • RsaJWK

      @Deprecated public RsaJWK(RSAPublicKey key, String use, String alg, String kid, String x5u, String x5t, List<String> x5c)
      Deprecated.
      Use the builder instead.
      Creates a RsaJWK.
      Parameters:
      key - the RSAPublicKey to use
      use - the use of the JWK
      alg - the alg of the JWK
      kid - the key id of the JWK
      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
    • RsaJWK

      @Deprecated public RsaJWK(RSAPublicKey pubKey, RSAPrivateKey privKey, String use, String alg, String kid, String x5u, String x5t, List<String> x5c)
      Deprecated.
      Use the builder instead.
      Creates a RsaJWK.
      Parameters:
      pubKey - the RSAPublicKey to use
      privKey - the RSAPrivateKey to use
      use - the use of the JWK
      alg - the alg of the JWK
      kid - the key id of the JWK
      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
    • RsaJWK

      @Deprecated public RsaJWK(RSAPublicKey pubKey, RSAPrivateCrtKey privCert, String use, String alg, String kid, String x5u, String x5t, List<String> x5c)
      Deprecated.
      Use the builder instead.
      Creates a RsaJWK.
      Parameters:
      pubKey - the RSAPublicKey to use
      privCert - the RSAPrivateCrtKey to use
      use - the use of the JWK
      alg - the alg of the JWK
      kid - the key id of the JWK
      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

    • builder

      public static RsaJWK.Builder builder(String modulus, String publicExponent)
      Get the builder.
      Parameters:
      modulus - the modulus of the JWK
      publicExponent - the public exponent JWK
      Returns:
      the RSA JWK builder
    • builder

      public static RsaJWK.Builder builder(RSAPublicKey publicKey)
      Get the builder.
      Parameters:
      publicKey - the RSAPublicKey to use
      Returns:
      the RSA JWK builder
    • getModulus

      public String getModulus()
      Get the RSA modulus value.
      Returns:
      a Base64url modulus value
    • getPublicExponent

      public String getPublicExponent()
      Get the RSA Public Exponent.
      Returns:
      a Base64url Public Exponent value
    • getPrivateExponent

      public String getPrivateExponent()
      Get the RSA Private Exponent value.
      Returns:
      a Base64url Private Exponent value
    • getPrimeP

      public String getPrimeP()
      Get the RSA First Prime Factor value.
      Returns:
      a Base64url First Prime Factor value
    • getPrimeQ

      public String getPrimeQ()
      Get the RSA Second Prime Factor value.
      Returns:
      a Base64url Second Prime Factor value
    • getPrimePExponent

      public String getPrimePExponent()
      Get the RSA First Factor CRT Exponent value.
      Returns:
      a Base64url First Factor CRT Exponent value
    • getPrimeQExponent

      public String getPrimeQExponent()
      Get the RSA Second factor CRT Exponent value.
      Returns:
      a Base64url Second factor CRT Exponent value
    • getCRTCoefficient

      public String getCRTCoefficient()
      Get the RSA First CRT Coefficient value.
      Returns:
      a Base64url First CRT Coefficient value
    • getOtherPrimesInfo

      public List<RsaJWK.PrimesInfo> getOtherPrimesInfo()
      Get the RSA other factors value.
      Returns:
      a Base64url other factors value
    • toRSAPublicKey

      public RSAPublicKey toRSAPublicKey()
      Creates a RSAPublicKey from the JWK.
      Returns:
      a RSAPublicKey
    • toRSAPrivateKey

      public RSAPrivateKey toRSAPrivateKey()
      Creates a RSAPrivateKey from the JWK.
      Returns:
      a RSAPrivateKey
    • isPrivate

      public boolean isPrivate()
      Description copied from class: JWK
      Indicates if any private key attributes are present in the JWK.
      Overrides:
      isPrivate in class JWK
      Returns:
      true if this JWK contains any private key attributes.
    • getPublicJwkBuilder

      protected Optional<JWK.Builder<?>> getPublicJwkBuilder()
      Description copied from class: JWK
      Return a builder with all the values set for representing the public components of the JWK. Common JWK attributes will be added in JWK.toPublicJwk().
      Specified by:
      getPublicJwkBuilder in class JWK
      Returns:
      The builder.
    • toKeyPair

      public KeyPair toKeyPair()
      Create a KeyPair using the JWK.
      Returns:
      a KeyPair
    • parse

      public static RsaJWK parse(String json)
      Parses a RsaJWK from a json string.
      Parameters:
      json - a string json object
      Returns:
      a RsaJWK
    • parse

      public static RsaJWK parse(JsonValue json)
      Parses a RsaJWK from a jsonValue Object.
      Parameters:
      json - a jsonValue object
      Returns:
      a RsaJWK
    • toJsonValue

      public JsonValue toJsonValue()
      Description copied from class: JWK
      Returns a json representation of the JWK.
      Overrides:
      toJsonValue in class JWK
      Returns:
      A JSON representation.