Package org.forgerock.json.jose.jwk
Interface EllipticCurveJwk
public interface EllipticCurveJwk
Encapsulates common functionality for JWKs that represent elliptic curve keys: EcJWK and OkpJWK.
-
Method Summary
Modifier and TypeMethodDescriptionThe elliptic curve this JWK is on.boolean
Determines whether the public key is a valid point on the underlying elliptic curve.Converts the public claims in the JWK into a public key object.Converts the JWK to a key pair.Converts the public claims in the JWK into a public key.
-
Method Details
-
isPublicKeyValid
boolean isPublicKeyValid()Determines whether the public key is a valid point on the underlying elliptic curve. This eliminates points of small-order and potentially other anomalous points. The caller should still check whether the point is on the curve it expected.- Returns:
- true if the public key is a valid point on the curve.
-
toECPublicKey
ECPublicKey toECPublicKey()Converts the public claims in the JWK into a public key object. This method is only compatible with EcJWKs and will throw an exception if called on an OkpJWK.- Returns:
- the public key.
-
toPublicKey
PublicKey toPublicKey()Converts the public claims in the JWK into a public key. Note that the public key returned may not be an ECPublicKey. For instance, on Java 11 an OkpJWK may return a XECPrivateKey.- Returns:
- the public key.
-
toKeyPair
KeyPair toKeyPair()Converts the JWK to a key pair.- Returns:
- the key pair.
-
getEllipticCurve
SupportedEllipticCurve getEllipticCurve()The elliptic curve this JWK is on.- Returns:
- the elliptic curve.
-