Class AbstractX509JWK<A extends PublicKey,B extends PrivateKey>
- Type Parameters:
A- the public key typeB- the private key type
- All Implemented Interfaces:
AsymmetricJWK<A,,B> JWK,X509JWK<A,B>
- Direct Known Subclasses:
AbstractOKPJWK,GenericECJWK,GenericRSAJWK
Base X.509 JSON Web Key implementation.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Optional<X509Certificate>The underlying certificate.protected String[]The X.509 Certificate Chain parameter as defined by RFC7517 Section 4.7.protected StringThe X.509 Certificate SHA-1 Thumbprint parameter as defined by RFC7517 Section 4.8.protected StringThe X.509 Certificate SHA-256 Thumbprint parameter as defined by RFC7517 Section 4.9.protected URIThe X.509 URL parameter as defined by RFC7517 Section 4.6.Fields 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
ConstructorsModifierConstructorDescriptionprotectedAbstractX509JWK(String kty) Creates an untrusted X.509 JWK.protectedAbstractX509JWK(String kty, X509Certificate certificate) Creates a public X.509 JWK with the specified X.509 certificate.protectedAbstractX509JWK(String kty, PrivateKey key, boolean trusted) Creates a private X.509 JWK with the specified private key.protectedAbstractX509JWK(String kty, PrivateKey key, X509Certificate certificate, boolean trusted) Creates an X.509 JWK with the specified private key and X.509 certificate. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the resolved certificate defining the public key.String[]Returns the X.509 certificate chain as defined by RFC7517 Section 4.7.Returns the X.509 SHA1 certificate thumbprint as defined by RFC7517 Section 4.8.Returns the X.509 SHA256 certificate thumbprint as defined by RFC7517 Section 4.9.Returns the X.509 certificate or certificates chain URL parameter as defined by RFC7517 Section 4.6.inthashCode()voidsetX509CertificateChain(String[] x5c) Sets the X.509 certificate chain.voidSets the X.509 SHA1 certificate thumbprint used to identify the key.voidsetX509CertificateSHA256Thumbprint(String x5t_S256) Sets the X.509 SHA256 certificate thumbprint used to identify the key.voidsetX509CertificateURL(URI x5u) Sets the X.509 certificate or certificates chain URL.toString()Methods 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, minify, signer, signer, supportsAlgorithm, toJWKThumbprint, toJWKThumbprintMethods inherited from interface io.inverno.mod.security.jose.jwk.X509JWK
toPublicJWK, trust
-
Field Details
-
certificate
The underlying certificate. -
x5u
The X.509 URL parameter as defined by RFC7517 Section 4.6. -
x5c
The X.509 Certificate Chain parameter as defined by RFC7517 Section 4.7. -
x5t
The X.509 Certificate SHA-1 Thumbprint parameter as defined by RFC7517 Section 4.8. -
x5t_S256
The X.509 Certificate SHA-256 Thumbprint parameter as defined by RFC7517 Section 4.9.
-
-
Constructor Details
-
AbstractX509JWK
Creates an untrusted X.509 JWK.
- Parameters:
kty- the key type- Throws:
JWKProcessingException- if the key type is blank
-
AbstractX509JWK
protected AbstractX509JWK(String kty, PrivateKey key, boolean trusted) throws JWKProcessingException Creates a private X.509 JWK with the specified private key.
- Parameters:
kty- the key typekey- a private keytrusted- true to create a trusted JWK, false otherwise- Throws:
JWKProcessingException- if the key type is blank
-
AbstractX509JWK
Creates a public X.509 JWK with the specified X.509 certificate.
The JWK is considered trusted if the specified certificate, which is assumed to be validated, is not null.
- Parameters:
kty- the key typecertificate- an X.509 certificate- Throws:
JWKProcessingException- if the key type is blank
-
AbstractX509JWK
protected AbstractX509JWK(String kty, PrivateKey key, X509Certificate certificate, boolean trusted) throws JWKProcessingException Creates an X.509 JWK with the specified private key and X.509 certificate.
- Parameters:
kty- the key typekey- a private keycertificate- an X.509 certificatetrusted- true to create a trusted JWK, false otherwise- Throws:
JWKProcessingException- if the key type is blank
-
-
Method Details
-
getX509CertificateURL
Description copied from interface:X509JWKReturns the X.509 certificate or certificates chain URL parameter as defined by RFC7517 Section 4.6.
The certificates chain located at the URL must be in PEM format. The certificate containing the public key must be the first certificate. The key in the first certificate MUST match the public key represented by other members of the JWK.
- Specified by:
getX509CertificateURLin interfaceX509JWK<A extends PublicKey,B extends PrivateKey> - Returns:
- the X.509 URI or null
-
setX509CertificateURL
Sets the X.509 certificate or certificates chain URL.
The URI must point to a resource which provides a PEM-encoded representation of the certificate or certificate chain. The key in the first certificate must correspond to the JWK public key.
- Parameters:
x5u- a URI
-
getX509CertificateChain
Description copied from interface:X509JWKReturns the X.509 certificate chain as defined by RFC7517 Section 4.7.
Each certificate is encoded in Base64 DER PKIX certificate value. The certificate containing the public key must be the first certificate. The key in the first certificate MUST match the public key represented by other members of the JWK.
- Specified by:
getX509CertificateChainin interfaceX509JWK<A extends PublicKey,B extends PrivateKey> - Returns:
- the X.509 certificate chain or null
-
setX509CertificateChain
Sets the X.509 certificate chain.
The elements of the array must be Base64URL encoded DER PKIX certificate values. The key in the first certificate must correspond to the JWK public key.
- Parameters:
x5c- an array of X.509 certificate
-
getX509CertificateSHA1Thumbprint
Description copied from interface:X509JWKReturns the X.509 SHA1 certificate thumbprint as defined by RFC7517 Section 4.8.
This fingerprint can be used to identify the actual certificate which must MUST match the public key represented by other members of the JWK.
- Specified by:
getX509CertificateSHA1Thumbprintin interfaceX509JWK<A extends PublicKey,B extends PrivateKey> - Returns:
- the X.509 SHA1 thumbprint or null
-
setX509CertificateSHA1Thumbprint
Sets the X.509 SHA1 certificate thumbprint used to identify the key.
- Parameters:
x5t- an X.509 SHA1 certificate thumbprint
-
getX509CertificateSHA256Thumbprint
Description copied from interface:X509JWKReturns the X.509 SHA256 certificate thumbprint as defined by RFC7517 Section 4.9.
This fingerprint can be used to identify the actual certificate which must MUST match the public key represented by other members of the JWK.
- Specified by:
getX509CertificateSHA256Thumbprintin interfaceX509JWK<A extends PublicKey,B extends PrivateKey> - Returns:
- the X.509 SHA1 thumbprint or null
-
setX509CertificateSHA256Thumbprint
Sets the X.509 SHA256 certificate thumbprint used to identify the key.
- Parameters:
x5t_S256- an X.509 SHA256 certificate thumbprint
-
getX509Certificate
Description copied from interface:X509JWKReturns the resolved certificate defining the public key.
- Specified by:
getX509Certificatein interfaceX509JWK<A extends PublicKey,B extends PrivateKey> - Returns:
- an optional containing the resolved certificate or an empty certificate if no certificate could have been resolve when building or reading the key
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceJWK- Overrides:
hashCodein classAbstractJWK
-
equals
- Specified by:
equalsin interfaceJWK- Overrides:
equalsin classAbstractJWK
-
toString
- Overrides:
toStringin classAbstractJWK
-