Package org.forgerock.json.jose.jwk
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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RsaJWK.Builder
The RSA JWK builder.static class
RsaJWK.PrimesInfo
Holds the other prime factors.
-
Field Summary
-
Fields inherited from class org.forgerock.json.jose.jwk.JWK
JSON_KEY_ALG, JSON_KEY_KID, JSON_KEY_KTY, JSON_KEY_OPERATIONS, JSON_KEY_USE, JSON_KEY_X5C, JSON_KEY_X5T, JSON_KEY_X5T_S256, JSON_KEY_X5U
-
-
Constructor Summary
Constructors Constructor Description 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.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.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.RsaJWK(String use, String alg, String kid, String modulus, String publicExponent, String x5u, String x5t, List<String> x5c)
Deprecated.Use the builder instead.RsaJWK(RSAPublicKey key, String use, String alg, String kid, String x5u, String x5t, List<String> x5c)
Deprecated.Use the builder instead.RsaJWK(RSAPublicKey pubKey, RSAPrivateCrtKey privCert, String use, String alg, String kid, String x5u, String x5t, List<String> x5c)
Deprecated.Use the builder instead.RsaJWK(RSAPublicKey pubKey, RSAPrivateKey privKey, String use, String alg, String kid, String x5u, String x5t, List<String> x5c)
Deprecated.Use the builder instead.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RsaJWK.Builder
builder(String modulus, String publicExponent)
Get the builder.static RsaJWK.Builder
builder(RSAPublicKey publicKey)
Get the builder.String
getCRTCoefficient()
Get the RSA First CRT Coefficient value.String
getModulus()
Get the RSA modulus value.List<RsaJWK.PrimesInfo>
getOtherPrimesInfo()
Get the RSA other factors value.String
getPrimeP()
Get the RSA First Prime Factor value.String
getPrimePExponent()
Get the RSA First Factor CRT Exponent value.String
getPrimeQ()
Get the RSA Second Prime Factor value.String
getPrimeQExponent()
Get the RSA Second factor CRT Exponent value.String
getPrivateExponent()
Get the RSA Private Exponent value.String
getPublicExponent()
Get the RSA Public Exponent.protected Optional<JWK.Builder<?>>
getPublicJwkBuilder()
Return a builder with all the values set for representing the public components of the JWK.boolean
isPrivate()
Indicates if any private key attributes are present in the JWK.static RsaJWK
parse(String json)
Parses a RsaJWK from a json string.static RsaJWK
parse(JsonValue json)
Parses a RsaJWK from a jsonValue Object.JsonValue
toJsonValue()
Returns a json representation of the JWK.KeyPair
toKeyPair()
Create a KeyPair using the JWK.RSAPrivateKey
toRSAPrivateKey()
Creates a RSAPrivateKey from the JWK.RSAPublicKey
toRSAPublicKey()
Creates a RSAPublicKey from the JWK.-
Methods inherited from class org.forgerock.json.jose.jwk.JWK
getAlgorithm, getAlgorithm, getJwaAlgorithm, getJwkThumbprint, getKeyId, getKeyOperations, getKeyType, getUse, getX509Chain, getX509Thumbnail, getX509Thumbprint, getX509ThumbprintS256, getX509URL, loadJWKFromJson, putField, toCryptoKey, toJsonString, toJsonValue, toPublicJwk
-
-
-
-
Constructor Detail
-
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 JWKalg
- the alg of the JWKkid
- the key id of the JWKmodulus
- the modulus of the JWKpublicExponent
- the public exponent JWKx5u
- the x509 url for the keyx5t
- the x509 thumbnail for the keyx5c
- 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 JWKalg
- the alg of the JWKkid
- the key id of the JWKmodulus
- the modulus of the JWKpublicExponent
- the public exponent JWKprivateExponent
- the private exponent JWKx5u
- the x509 url for the keyx5t
- the x509 thumbnail for the keyx5c
- 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 JWKalg
- the alg of the JWKkid
- the key id of the JWKmodulus
- the modulus of the JWKpublicExponent
- the public exponent JWKprimeP
- the first prime factor of the JWKprimeQ
- the second prime factor of the JWKprimePExponent
- the first factor exponent of the JWKprimeQExponent
- the second factor exponent of the JWKcrtCoefficient
- the first CRT Coefficient of the JWKx5u
- the x509 url for the keyx5t
- the x509 thumbnail for the keyx5c
- 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 JWKalg
- the alg of the JWKkid
- the key id of the JWKmodulus
- the modulus of the JWKpublicExponent
- the public exponent JWKprivateExponent
- the private exponent JWKprimeP
- the first prime factor of the JWKprimeQ
- the second prime factor of the JWKprimePExponent
- the first factor exponent of the JWKprimeQExponent
- the second factor exponent of the JWKcrtCoefficient
- the first CRT Coefficient of the JWKotherPrimesInfo
- the extra factors of the JWKx5u
- the x509 url for the keyx5t
- the x509 thumbnail for the keyx5c
- 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 useuse
- the use of the JWKalg
- the alg of the JWKkid
- the key id of the JWKx5u
- the x509 url for the keyx5t
- the x509 thumbnail for the keyx5c
- 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 useprivKey
- the RSAPrivateKey to useuse
- the use of the JWKalg
- the alg of the JWKkid
- the key id of the JWKx5u
- the x509 url for the keyx5t
- the x509 thumbnail for the keyx5c
- 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 useprivCert
- the RSAPrivateCrtKey to useuse
- the use of the JWKalg
- the alg of the JWKkid
- the key id of the JWKx5u
- the x509 url for the keyx5t
- the x509 thumbnail for the keyx5c
- the x509 chain as a list of Base64 encoded strings
-
-
Method Detail
-
builder
public static RsaJWK.Builder builder(String modulus, String publicExponent)
Get the builder.- Parameters:
modulus
- the modulus of the JWKpublicExponent
- 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.
-
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 inJWK.toPublicJwk()
.- Specified by:
getPublicJwkBuilder
in classJWK
- 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 classJWK
- Returns:
- A JSON representation.
-
-