Class Jwk
java.lang.Object
com.revetsec.jose.Jwk
One usable public key from a
Jwks: an RSA, EC (P-256, P-384 or P-521) or Ed25519 key that passed
every rule for verifying JWS signatures (see JwkSkipReason).
Instances exist only for such keys, so there is no public factory: they come from
Jwks.getKeys(). This class describes the key; it holds no private key material and exposes no
JCA key.
Equality is by value: the RFC 7638 thumbprint, which identifies the key material, and the
kid, alg and use members, and also the key's JWK issuer member, which this class does
not expose but which decides the tokens the key may verify. toString() shows the key ID with its control
characters escaped, the key type, curve and algorithm, and the thumbprint.
- Since:
- 1.0.0
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares by value: the thumbprint, key ID, algorithm, use and the JWKissuermember.Returns the algorithm the key is restricted to (alg, RFC 7517 section 4.4).getCurve()Returns the curve (crv; RFC 7518 section 6.2.1.1, RFC 8037 section 2).getKeyId()Returns the key ID (kid, RFC 7517 section 4.5).Returns the key type (kty, RFC 7517 section 4.1).Returns the key's RFC 7638 JWK thumbprint with SHA-256, which identifies the key material whatever its other members say.getUse()Returns the key's intended use (use, RFC 7517 section 4.2).inthashCode()Returns a hash of the thumbprint.toString()Describes the key by its public facts.
-
Method Details
-
getKeyId
-
getKeyType
Returns the key type (kty, RFC 7517 section 4.1).- Returns:
RSA,ECorOKP- Since:
- 1.0.0
-
getCurve
-
getAlgorithm
Returns the algorithm the key is restricted to (alg, RFC 7517 section 4.4). A key with an algorithm verifies only that algorithm, except thatJwsAlgorithm.EDDSAandJwsAlgorithm.ED25519verify each other; an RSA key without one verifies only while exactly one RSA algorithm is allowed.- Returns:
- the algorithm, or empty if the key has none
- Since:
- 1.0.0
-
getUse
-
getThumbprintSha256
Returns the key's RFC 7638 JWK thumbprint with SHA-256, which identifies the key material whatever its other members say.- Returns:
- the thumbprint, in unpadded base64url (43 characters)
- Since:
- 1.0.0
-
equals
-
hashCode
-
toString
-