Class GenericRSAJWKBuilder
- All Implemented Interfaces:
JWKBuilder<GenericRSAJWK,,GenericRSAJWKBuilder> RSAJWKBuilder<GenericRSAJWK,,GenericRSAJWKBuilder> X509JWKBuilder<RSAPublicKey,,RSAPrivateKey, GenericRSAJWK, GenericRSAJWKBuilder> Cloneable
Generic RSA JSON Web Key builder implementation.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Field Summary
Fields inherited from class io.inverno.mod.security.jose.internal.jwk.AbstractX509JWKBuilder
certificate, certPathValidator, keyTrusted, urlResolver, x5c, x5t, x5t_S256, x5uFields inherited from class io.inverno.mod.security.jose.internal.jwk.AbstractJWKBuilder
alg, configuration, jwkStore, key, key_ops, keyResolver, kid, use -
Constructor Summary
ConstructorsConstructorDescriptionGenericRSAJWKBuilder(JOSEConfiguration configuration, JWKStore jwkStore, JWKKeyResolver keyResolver, JWKURLResolver urlResolver, X509JWKCertPathValidator certPathValidator) Creates a generic RSA JWK builder.GenericRSAJWKBuilder(JOSEConfiguration configuration, JWKStore jwkStore, JWKKeyResolver keyResolver, JWKURLResolver urlResolver, X509JWKCertPathValidator certPathValidator, Map<String, Object> parameters) Creates a generic RSA JWK builder initialized with the specified parameters map. -
Method Summary
Modifier and TypeMethodDescriptionSpecifies the algorithm intended for use with the key.protected reactor.core.publisher.Mono<GenericRSAJWK>doBuild()Builds the JWK after all checks and processing have terminated successfully.Specifies the first coefficient encoded as Base64URL.Specifies the first factor exponent encoded as Base64URL.Specifies the first prime factor encoded as Base64URL.Specifies the modulus encoded as Base64URL.otherPrimeInfo(String primeFactor, String exponent, String coefficient) Specifies a prime info to add to the definition of the key.Specifies the private exponent encoded as Base64URL.Specifies the public exponent encoded as Base64URL.protected reactor.core.publisher.Mono<Void>resolve()Resolves the JWK to build.protected reactor.core.publisher.Mono<Void>resolveCertificate(X509Certificate certificate) Resolves the specified certificate into the builder.protected reactor.core.publisher.Mono<JWK>Tries to resolve the JWK from the JWK store.protected reactor.core.publisher.Mono<Void>resolveKey(Key key) Resolves the specified key into the builder.Specifies the second factor exponent encoded as Base64URL.Specifies the second prime factor encoded as Base64URL.protected voidSets the specified parameter into the builder.Methods inherited from class io.inverno.mod.security.jose.internal.jwk.AbstractX509JWKBuilder
x509CertificateChain, x509CertificateSHA1Thumbprint, x509CertificateSHA256Thumbprint, x509CertificateURLMethods inherited from class io.inverno.mod.security.jose.internal.jwk.AbstractJWKBuilder
build, keyId, keyOperations, publicKeyUseMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.inverno.mod.security.jose.jwk.JWKBuilder
build, keyId, keyOperations, publicKeyUseMethods inherited from interface io.inverno.mod.security.jose.jwk.X509JWKBuilder
x509CertificateChain, x509CertificateSHA1Thumbprint, x509CertificateSHA256Thumbprint, x509CertificateURL
-
Constructor Details
-
GenericRSAJWKBuilder
public GenericRSAJWKBuilder(JOSEConfiguration configuration, JWKStore jwkStore, JWKKeyResolver keyResolver, JWKURLResolver urlResolver, X509JWKCertPathValidator certPathValidator) Creates a generic RSA JWK builder.
- Parameters:
configuration- the JOSE module configurationjwkStore- a JWK storekeyResolver- a JWK key resolverurlResolver- a JWK URL resolvercertPathValidator- an X.509 certificate path validator
-
GenericRSAJWKBuilder
public GenericRSAJWKBuilder(JOSEConfiguration configuration, JWKStore jwkStore, JWKKeyResolver keyResolver, JWKURLResolver urlResolver, X509JWKCertPathValidator certPathValidator, Map<String, Object> parameters) throws JWKReadExceptionCreates a generic RSA JWK builder initialized with the specified parameters map.
- Parameters:
configuration- the JOSE module configurationjwkStore- a JWK storekeyResolver- a JWK key resolverurlResolver- a JWK URL resolvercertPathValidator- an X.509 certificate path validatorparameters- a parameters map used to initialize the builder- Throws:
JWKReadException- if there was an error reading the parameters map
-
-
Method Details
-
set
Description copied from class:AbstractX509JWKBuilderSets the specified parameter into the builder.
Unsupported parameters are ignored.
- Overrides:
setin classAbstractX509JWKBuilder<RSAPublicKey,RSAPrivateKey, GenericRSAJWK, GenericRSAJWKBuilder> - Parameters:
field- the parameter namevalue- the parameter value- Throws:
JWKReadException- if there was an error reading the value
-
algorithm
Description copied from interface:JWKBuilderSpecifies the algorithm intended for use with the key.
- Specified by:
algorithmin interfaceJWKBuilder<GenericRSAJWK,GenericRSAJWKBuilder> - Overrides:
algorithmin classAbstractJWKBuilder<GenericRSAJWK,GenericRSAJWKBuilder> - Parameters:
alg- a JWA algorithm- Returns:
- this builder
-
modulus
Description copied from interface:RSAJWKBuilderSpecifies the modulus encoded as Base64URL.
- Specified by:
modulusin interfaceRSAJWKBuilder<GenericRSAJWK,GenericRSAJWKBuilder> - Parameters:
n- the Base64URL encoded modulus with no padding- Returns:
- this builder
-
publicExponent
Description copied from interface:RSAJWKBuilderSpecifies the public exponent encoded as Base64URL.
- Specified by:
publicExponentin interfaceRSAJWKBuilder<GenericRSAJWK,GenericRSAJWKBuilder> - Parameters:
e- the Base64URL encoded public exponent with no padding- Returns:
- this builder
-
privateExponent
Description copied from interface:RSAJWKBuilderSpecifies the private exponent encoded as Base64URL.
- Specified by:
privateExponentin interfaceRSAJWKBuilder<GenericRSAJWK,GenericRSAJWKBuilder> - Parameters:
d- the Base64URL encoded private exponent with no padding- Returns:
- this builder
-
firstPrimeFactor
Description copied from interface:RSAJWKBuilderSpecifies the first prime factor encoded as Base64URL.
- Specified by:
firstPrimeFactorin interfaceRSAJWKBuilder<GenericRSAJWK,GenericRSAJWKBuilder> - Parameters:
p- the Base64URL encoded first prime factor with no padding- Returns:
- this builder
-
secondPrimeFactor
Description copied from interface:RSAJWKBuilderSpecifies the second prime factor encoded as Base64URL.
- Specified by:
secondPrimeFactorin interfaceRSAJWKBuilder<GenericRSAJWK,GenericRSAJWKBuilder> - Parameters:
q- the Base64URL encoded second prime factor with no padding- Returns:
- this builder
-
firstFactorExponent
Description copied from interface:RSAJWKBuilderSpecifies the first factor exponent encoded as Base64URL.
- Specified by:
firstFactorExponentin interfaceRSAJWKBuilder<GenericRSAJWK,GenericRSAJWKBuilder> - Parameters:
dp- the Base64URL encoded first factor exponent with no padding- Returns:
- this builder
-
secondFactorExponent
Description copied from interface:RSAJWKBuilderSpecifies the second factor exponent encoded as Base64URL.
- Specified by:
secondFactorExponentin interfaceRSAJWKBuilder<GenericRSAJWK,GenericRSAJWKBuilder> - Parameters:
dq- the Base64URL encoded second factor exponent with no padding- Returns:
- this builder
-
firstCoefficient
Description copied from interface:RSAJWKBuilderSpecifies the first coefficient encoded as Base64URL.
- Specified by:
firstCoefficientin interfaceRSAJWKBuilder<GenericRSAJWK,GenericRSAJWKBuilder> - Parameters:
qi- the Base64URL encoded first coefficient with no padding- Returns:
- this builder
-
otherPrimeInfo
Description copied from interface:RSAJWKBuilderSpecifies a prime info to add to the definition of the key.
- Specified by:
otherPrimeInfoin interfaceRSAJWKBuilder<GenericRSAJWK,GenericRSAJWKBuilder> - Parameters:
primeFactor- the Base64URL encoded other prime info prime factor with no paddingexponent- the Base64URL encoded other prime info exponent with no paddingcoefficient- the Base64URL encoded other prime info coefficient with no padding- Returns:
- this builder
-
resolveFromJWKStore
Description copied from class:AbstractJWKBuilderTries to resolve the JWK from the JWK store.
- Overrides:
resolveFromJWKStorein classAbstractX509JWKBuilder<RSAPublicKey,RSAPrivateKey, GenericRSAJWK, GenericRSAJWKBuilder> - Returns:
- a single JWK publisher or an empty publisher if there's no JWK corresponding to the builder's parameters in the JWK store
- Throws:
JWKResolveException- if there was an error accessing the JWK store
-
resolveKey
protected reactor.core.publisher.Mono<Void> resolveKey(Key key) throws JWKBuildException, JWKResolveException, JWKProcessingException Description copied from class:AbstractJWKBuilderResolves the specified key into the builder.
This method basically verifies that the key is valid and consistent with the builder's parameters and eventually populates the builder with the key.
- Specified by:
resolveKeyin classAbstractJWKBuilder<GenericRSAJWK,GenericRSAJWKBuilder> - Parameters:
key- a key- Returns:
- an empty single publisher which completes in error if the key is not consistent with the builder's parameters
- Throws:
JWKBuildException- if there was an error building the JWKJWKResolveException- if there was an error resolving the keyJWKProcessingException- if there was a JWK processing error
-
resolveCertificate
protected reactor.core.publisher.Mono<Void> resolveCertificate(X509Certificate certificate) throws JWKBuildException, JWKResolveException, JWKProcessingException Description copied from class:AbstractX509JWKBuilderResolves the specified certificate into the builder.
This method basically verifies that the certificate is valid and consistent with the builder's parameters and eventually populates the builder with the certificate key.
- Overrides:
resolveCertificatein classAbstractX509JWKBuilder<RSAPublicKey,RSAPrivateKey, GenericRSAJWK, GenericRSAJWKBuilder> - Parameters:
certificate- a certificate- Returns:
- an empty single publisher which completes in error if the resolved key is invalid or inconsistent with the builder's parameters
- Throws:
JWKBuildException- if there was an error building the JWKJWKResolveException- if there was an error resolving the certificateJWKProcessingException- if there was a JWK processing error
-
resolve
protected reactor.core.publisher.Mono<Void> resolve() throws JWKBuildException, JWKResolveException, JWKProcessingExceptionDescription copied from class:AbstractJWKBuilderResolves the JWK to build.
This method basically resolves resources such as keys or certificates and verifies that the builder's parameters are consistent.
- Overrides:
resolvein classAbstractX509JWKBuilder<RSAPublicKey,RSAPrivateKey, GenericRSAJWK, GenericRSAJWKBuilder> - Returns:
- an empty single publisher which completes in error if the key is not consistent with the builder's parameters
- Throws:
JWKBuildException- if there was an error building the JWKJWKResolveException- if there was an error resolving the JWKJWKProcessingException- if there was a JWK processing error
-
doBuild
protected reactor.core.publisher.Mono<GenericRSAJWK> doBuild() throws JWKBuildException, JWKProcessingExceptionDescription copied from class:AbstractJWKBuilderBuilds the JWK after all checks and processing have terminated successfully.
- Specified by:
doBuildin classAbstractJWKBuilder<GenericRSAJWK,GenericRSAJWKBuilder> - Returns:
- a single JWK publisher
- Throws:
JWKBuildException- if there was an error building the JWKJWKProcessingException- if there was a JWK processing error
-