Module io.inverno.mod.security.jose
Class GenericOCTJWKGenerator
java.lang.Object
io.inverno.mod.security.jose.internal.jwk.AbstractJWKGenerator<GenericOCTJWK,GenericOCTJWKGenerator>
io.inverno.mod.security.jose.internal.jwk.oct.GenericOCTJWKGenerator
- All Implemented Interfaces:
JWKGenerator<GenericOCTJWK,,GenericOCTJWKGenerator> OCTJWKGenerator<GenericOCTJWK,GenericOCTJWKGenerator>
public class GenericOCTJWKGenerator
extends AbstractJWKGenerator<GenericOCTJWK,GenericOCTJWKGenerator>
implements OCTJWKGenerator<GenericOCTJWK,GenericOCTJWKGenerator>
Generic Octet JSON Web Key generator implementation.
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe default key size.static final intThe minimum key size.Fields inherited from class io.inverno.mod.security.jose.internal.jwk.AbstractJWKGenerator
alg, key_ops, kid, use -
Constructor Summary
ConstructorsConstructorDescriptionCreates a generic OCT JWK generator.GenericOCTJWKGenerator(Map<String, Object> parameters) Creates a generic OCT JWK generator initialized with the specified parameters map. -
Method Summary
Modifier and TypeMethodDescriptionSpecifies the algorithm intended for use with the key.reactor.core.publisher.Mono<GenericOCTJWK>Generates the JWK after all checks and processing have terminated successfully.keySize(int keySize) Specifies the size of the key to generate in bytes.secureRandom(SecureRandom secureRandom) Specifies the secure random to use to generate the key.protected voidSets the specified parameter into the generator.protected reactor.core.publisher.Mono<Void>verify()Verifies that the generator's parameters are consistent and that we can proceed with the generation of the key.Methods inherited from class io.inverno.mod.security.jose.internal.jwk.AbstractJWKGenerator
generate, 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.JWKGenerator
generate, keyId, keyOperations, publicKeyUse
-
Field Details
-
MINIMUM_KEY_SIZE
public static final int MINIMUM_KEY_SIZEThe minimum key size.- See Also:
-
DEFAULT_KEY_SIZE
public static final int DEFAULT_KEY_SIZEThe default key size.- See Also:
-
-
Constructor Details
-
GenericOCTJWKGenerator
public GenericOCTJWKGenerator()Creates a generic OCT JWK generator.
-
GenericOCTJWKGenerator
Creates a generic OCT JWK generator initialized with the specified parameters map.
- Parameters:
parameters- a parameters map used to initialize the generator- Throws:
JWKGenerateException- if there was an error reading the parameters map
-
-
Method Details
-
set
Description copied from class:AbstractJWKGeneratorSets the specified parameter into the generator.
Unsupported parameters are ignored.
- Overrides:
setin classAbstractJWKGenerator<GenericOCTJWK,GenericOCTJWKGenerator> - Parameters:
field- the parameter namevalue- the parameter value- Throws:
JWKGenerateException- if there was an error reading the value
-
algorithm
Description copied from interface:JWKGeneratorSpecifies the algorithm intended for use with the key.
- Specified by:
algorithmin interfaceJWKGenerator<GenericOCTJWK,GenericOCTJWKGenerator> - Overrides:
algorithmin classAbstractJWKGenerator<GenericOCTJWK,GenericOCTJWKGenerator> - Parameters:
alg- a JWA algorithm- Returns:
- this generator
-
keySize
Description copied from interface:OCTJWKGeneratorSpecifies the size of the key to generate in bytes.
- Specified by:
keySizein interfaceOCTJWKGenerator<GenericOCTJWK,GenericOCTJWKGenerator> - Parameters:
keySize- the size of the key in bytes- Returns:
- this generator
-
secureRandom
Description copied from interface:OCTJWKGeneratorSpecifies the secure random to use to generate the key.
If not specified a default secure random will be used.
- Specified by:
secureRandomin interfaceOCTJWKGenerator<GenericOCTJWK,GenericOCTJWKGenerator> - Parameters:
secureRandom- a secure random- Returns:
- this builder
-
verify
protected reactor.core.publisher.Mono<Void> verify() throws JWKGenerateException, JWKProcessingExceptionDescription copied from class:AbstractJWKGeneratorVerifies that the generator's parameters are consistent and that we can proceed with the generation of the key.
- Overrides:
verifyin classAbstractJWKGenerator<GenericOCTJWK,GenericOCTJWKGenerator> - Returns:
- an empty single publisher which completes in error if generator's parameters are invalid or inconsistent
- Throws:
JWKGenerateException- if there was an error generating the JWKJWKProcessingException- if there was a JWK processing error
-
doGenerate
public reactor.core.publisher.Mono<GenericOCTJWK> doGenerate() throws JWKGenerateException, JWKProcessingExceptionDescription copied from class:AbstractJWKGeneratorGenerates the JWK after all checks and processing have terminated successfully.
- Specified by:
doGeneratein classAbstractJWKGenerator<GenericOCTJWK,GenericOCTJWKGenerator> - Returns:
- a single JWK publisher
- Throws:
JWKGenerateException- if there was an error generating the JWKJWKProcessingException- if there was a JWK processing error
-