Class AbstractOKPJWK<A extends PublicKey,B extends PrivateKey>
- Type Parameters:
A- the public key typeB- the private key type
- All Implemented Interfaces:
AsymmetricJWK<A,,B> JWK,OKPJWK<A,,B> X509JWK<A,B>
- Direct Known Subclasses:
GenericEdECJWK,GenericXECJWK
Base Octet Key Pair JSON Web Key implementation.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final OKPCurveThe Curve parameter as defined by RFC8037 Section 3.protected final StringThe private key parameter as defined by RFC8037 Section 3.The private key.protected AThe public key.protected final StringThe public key parameter as defined by RFC8037 Section 3.Fields inherited from class io.inverno.mod.security.jose.internal.jwk.AbstractX509JWK
certificate, x5c, x5t, x5t_S256, x5uFields inherited from class io.inverno.mod.security.jose.internal.jwk.AbstractJWK
alg, key, key_ops, kid, kty, trusted, useFields inherited from interface io.inverno.mod.security.jose.jwk.JWK
DEFAULT_THUMBPRINT_DIGEST, KEY_OP_DECRYPT, KEY_OP_DERIVE_BITS, KEY_OP_DERIVE_KEY, KEY_OP_ENCRYPT, KEY_OP_SIGN, KEY_OP_UNWRAP_KEY, KEY_OP_VERIFY, KEY_OP_WRAP_KEY, USE_ENC, USE_SIG -
Constructor Summary
ConstructorsConstructorDescriptionAbstractOKPJWK(OKPCurve curve, String x) Creates an untrusted public OKP JWK with the specified curve and public key value.AbstractOKPJWK(OKPCurve curve, String x, String d) Creates an untrusted private OKP JWK with the specified curve, public key value and private key value.AbstractOKPJWK(OKPCurve curve, String x, String d, B key, boolean trusted) Creates a private OKP JWK with the specified curve, public key value, private key value and private key.AbstractOKPJWK(OKPCurve curve, String x, String d, B key, X509Certificate certificate, boolean trusted) Creates a private OKP JWK with the specified curve, public coordinates, private key value, OKP private key and certificate.AbstractOKPJWK(OKPCurve curve, String x, String d, X509Certificate certificate) Creates a public OKP JWK with the specified curve, public key value, private key value and certificate.AbstractOKPJWK(OKPCurve curve, String x, X509Certificate certificate) Creates a public OKP JWK with the specified curve, public key value and certificate. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetCurve()Returns the JWA Elliptic curve name.Returns the private key encoded as Base64URL.Returns the public key encoded as Base64URL.inthashCode()protected static voidreverse(byte[] arr) Reverses the specified byte array.protected static voidswap(byte[] arr, int i, int j) Swaps the bytes at positions i and j in the specified byte array.toJWKThumbprint(MessageDigest digest) Generates and returns the JWK thumbprint using the specified digest.Methods inherited from class io.inverno.mod.security.jose.internal.jwk.AbstractX509JWK
getX509Certificate, getX509CertificateChain, getX509CertificateSHA1Thumbprint, getX509CertificateSHA256Thumbprint, getX509CertificateURL, setX509CertificateChain, setX509CertificateSHA1Thumbprint, setX509CertificateSHA256Thumbprint, setX509CertificateURL, toStringMethods inherited from class io.inverno.mod.security.jose.internal.jwk.AbstractJWK
checkEncryption, checkKeyManagement, checkSignature, cipher, cipher, getAlgorithm, getDefaultThumbprintDigest, getKey, getKeyId, getKeyOperations, getKeyType, getPublicKeyUse, isTrusted, keyManager, keyManager, setAlgorithm, setKeyId, setKeyOperations, setPublicKeyUse, signer, signerMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.inverno.mod.security.jose.jwk.AsymmetricJWK
toPrivateKey, toPublicKeyMethods inherited from interface io.inverno.mod.security.jose.jwk.JWK
cipher, cipher, getAlgorithm, getKeyId, getKeyOperations, getKeyType, getPublicKeyUse, isTrusted, keyManager, keyManager, signer, signer, supportsAlgorithm, toJWKThumbprintMethods inherited from interface io.inverno.mod.security.jose.jwk.okp.OKPJWK
minify, toPublicJWK, trustMethods inherited from interface io.inverno.mod.security.jose.jwk.X509JWK
getX509Certificate, getX509CertificateChain, getX509CertificateSHA1Thumbprint, getX509CertificateSHA256Thumbprint, getX509CertificateURL
-
Field Details
-
curve
The Curve parameter as defined by RFC8037 Section 3. -
x
The public key parameter as defined by RFC8037 Section 3. -
d
The private key parameter as defined by RFC8037 Section 3. -
publicKey
The public key. -
privateKey
The private key.
-
-
Constructor Details
-
AbstractOKPJWK
Creates an untrusted public OKP JWK with the specified curve and public key value.
- Parameters:
curve- an elliptic curvex- the public key value encoded as Base64URL without padding
-
AbstractOKPJWK
Creates a public OKP JWK with the specified curve, public key value and certificate.
The JWK is considered trusted if the specified certificate, which is assumed to be validated, is not null.
- Parameters:
curve- an elliptic curvex- the public key encoded as Base64URL without paddingcertificate- an X.509 certificate
-
AbstractOKPJWK
Creates an untrusted private OKP JWK with the specified curve, public key value and private key value.
- Parameters:
curve- an elliptic curvex- the public key value encoded as Base64URL without paddingd- the private key value encoded as Base64URL without padding
-
AbstractOKPJWK
Creates a private OKP JWK with the specified curve, public key value, private key value and private key.
- Parameters:
curve- an elliptic curvex- the public key value encoded as Base64URL without paddingd- the private key value encoded as Base64URL without paddingkey- a private keytrusted- true to create a trusted JWK, false otherwise
-
AbstractOKPJWK
Creates a public OKP JWK with the specified curve, public key value, private key value and certificate.
The JWK is considered trusted if the specified certificate, which is assumed to be validated, is not null.
- Parameters:
curve- an elliptic curvex- the public key value encoded as Base64URL without paddingd- the private key value encoded as Base64URL without paddingcertificate- an X.509 certificate
-
AbstractOKPJWK
public AbstractOKPJWK(OKPCurve curve, String x, String d, B key, X509Certificate certificate, boolean trusted) Creates a private OKP JWK with the specified curve, public coordinates, private key value, OKP private key and certificate.
- Parameters:
curve- an elliptic curvex- the public key value encoded as Base64URL without paddingd- the private key value encoded as Base64URL without paddingkey- a private keycertificate- an X.509 certificatetrusted- true to create a trusted JWK, false otherwise
-
-
Method Details
-
getCurve
Description copied from interface:OKPJWKReturns the JWA Elliptic curve name.
-
getPublicKey
Description copied from interface:OKPJWKReturns the public key encoded as Base64URL.
- Specified by:
getPublicKeyin interfaceOKPJWK<A extends PublicKey,B extends PrivateKey> - Returns:
- the Base64URL encoded public key with no padding.
-
getPrivateKey
Description copied from interface:OKPJWKReturns the private key encoded as Base64URL.
- Specified by:
getPrivateKeyin interfaceOKPJWK<A extends PublicKey,B extends PrivateKey> - Returns:
- the Base64URL encoded private key with no padding.
-
toJWKThumbprint
Description copied from interface:JWKGenerates and returns the JWK thumbprint using the specified digest.
- Specified by:
toJWKThumbprintin interfaceJWK- Parameters:
digest- the message digest to use- Returns:
- the JWK thumbprint
-
reverse
protected static void reverse(byte[] arr) Reverses the specified byte array.
- Parameters:
arr- the byte array to reverse
-
swap
protected static void swap(byte[] arr, int i, int j) Swaps the bytes at positions i and j in the specified byte array.
- Parameters:
arr- a byte arrayi- an indexj- an index
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceJWK- Overrides:
hashCodein classAbstractX509JWK<A extends PublicKey,B extends PrivateKey>
-
equals
- Specified by:
equalsin interfaceJWK- Overrides:
equalsin classAbstractX509JWK<A extends PublicKey,B extends PrivateKey>
-