K
- The type of Edwards-curve PrivateKey
represented by this JWK (e.g. XECPrivateKey, EdECPrivateKey, etc).L
- The type of Edwards-curve PublicKey
represented by the JWK's corresponding
public JWK
, for example XECPublicKey, EdECPublicKey, etc.public interface OctetPrivateJwk<K extends PrivateKey,L extends PublicKey> extends PrivateJwk<K,L,OctetPublicJwk<L>>
PrivateKey
as defined by RFC 8037, Section 2:
Key Type "OKP".
Unlike the EcPrivateJwk
interface, which only supports
Weierstrass-form ECPrivateKey
s,
OctetPrivateJwk
allows for multiple parameterized PrivateKey
types
because the JDK supports two different types of Edwards Curve private keys:
As such, OctetPrivateJwk
is parameterized to support both key types.
Earlier JDK Versions
Even though XECPrivateKey
and EdECPrivateKey
were introduced in JDK 11 and JDK 15 respectively,
JJWT supports Octet private JWKs in earlier versions when BouncyCastle is enabled in the application classpath. When
using earlier JDK versions, the OctetPrivateJwk
instance will need be parameterized with the
generic PrivateKey
type since the latter key types would not be present. For example:
OctetPrivateJwk<PrivateKey> octetPrivateJwk = getKey();
OKP-specific Properties
Note that the various OKP-specific properties are not available as separate dedicated getter methods, as most Java
applications should rarely, if ever, need to access these individual key properties since they typically represent
internal key material and/or serialization details. If you need to access these key properties, it is usually
recommended to obtain the corresponding PrivateKey
instance returned by Jwk.toKey()
and
query that instead.
Even so, because these properties exist and are readable by nature of every JWK being a
Map
, they are still accessible via the standard Map
get
method
using an appropriate JWK parameter id, for example:
jwk.get("x"); jwk.get("d"); // ... etc ...
toKeyPair, toPublicJwk
getPublicKeyUse
getAlgorithm, getOperations, getType, thumbprint, thumbprint, toKey
getId
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
getX509Chain, getX509Sha1Thumbprint, getX509Sha256Thumbprint, getX509Url
Copyright © 2014–2025 jsonwebtoken.io. All rights reserved.