Package io.fusionauth.jwks.domain
Class JSONWebKey
java.lang.Object
io.fusionauth.jwks.domain.JSONWebKey
- All Implemented Interfaces:
Buildable<JSONWebKey>
A JSON Web Key as defined by RFC 7517 JSON Web Key (JWK)
Section 4 and RFC 7518 JSON Web Algorithms (JWA).
- Author:
- Daniel DeGroff
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe "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 CurveThe "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 -
Method Summary
Modifier and TypeMethodDescriptionstatic JSONWebKeyBuild a JSON Web Key from an encoded PEM.static JSONWebKeybuild(Certificate certificate) Build a JSON Web Key from a certificatestatic JSONWebKeybuild(PrivateKey privateKey) Build a JSON Web Key from a private keystatic JSONWebKeyBuild a JSON Web Key from a public keybooleangetOther()inthashCode()static PublicKeyparse(JSONWebKey key) Build a public key from a JSON Web Key containing a public RSA or EC key.toJSON()toString()
-
Field Details
-
alg
The "alg" parameter identifies the algorithm intended for use with this key. -
crv
The name of the Elliptic curve.- P-256
- P-384
- P-521
-
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
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
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
The "e" parameter contains the public exponent value for the RSA public key. It is represented as a Base64urlUInt-encoded value. -
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
The key type parameter.- EC : Elliptic Curve
- RSA : RSA
- oct : Octet sequence (used to represent symmetric keys)
-
n
The "n" parameter contains the modulus value for the RSA public key. It is represented as a Base64urlUInt-encoded value. -
other
This Map will contain all the properties that aren't specifically defined in this class. -
p
The "p" parameter contains the first prime factor for the RSA private key. It is represented as a Base64urlUInt-encoded value. -
q
The "q" parameter contains the second prime factor for the RSA private key. It is represented as a Base64urlUInt-encoded value. -
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
The "use" parameter identifies the intended use of the public key.- sig : signature
- enc : encryption
-
x
The "x" parameter is the x coordinate of the Elliptic Curve -
x5c
The "x5c" parameter contains the encoded X509 certificate chain. -
x5t
The x.509 SHA-1 certificate thumbprint. -
x5t_256
The x.509 SHA-256 certificate thumbprint. -
y
The "y" parameter is the y coordinate of the Elliptic Curve
-
-
Constructor Details
-
JSONWebKey
public JSONWebKey()
-
-
Method Details
-
build
Build a JSON Web Key from an encoded PEM.- Parameters:
encodedPEM- an encoded PEM- Returns:
- a JSON Web Key
-
parse
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
Build a JSON Web Key from a certificate- Parameters:
certificate- the certificate- Returns:
- a JSON Web Key
-
build
Build a JSON Web Key from a private key- Parameters:
privateKey- a private key- Returns:
- a JSON Web Key
-
build
Build a JSON Web Key from a public key- Parameters:
publicKey- a public key- Returns:
- a JSON Web Key
-
add
-
equals
-
getOther
-
hashCode
public int hashCode() -
toJSON
-
toString
-