Skip to content

KeyStore Config Source#

This Config Source allows to use a Java KeyStore to load configuration values. It uses an ordinal of 100.

The following dependency is required in the classpath to use the KeyStore Config Source:

<dependency>
    <groupId>io.smallrye.config</groupId>
    <artifactId>smallrye-config-source-keystore</artifactId>
    <version>3.9.1-SNAPSHOT</version>
</dependency>

Create a KeyStore#

The following command creates a simple KeyStore

keytool -importpass -alias my.secret -keystore keystore -storepass secret -storetype PKCS12 -v

The -alias my.secret stores the configuration property name my.secret in the KeyStore. The command will interactively ask for the value to be stored in the KeyStore.

Read the KeyStore#

The KeyStore Config Source supports reading multiple keystore files:

smallrye.config.source.keystore.one.path=keystore-one
smallrye.config.source.keystore.one.password=password

smallrye.config.source.keystore.two.path=keystore-two
smallrye.config.source.keystore.two.password=password

The names are arbitrary and can be any name. The name one and two are used to distinguish both KeyStores.

If a stored configuration property requires a Secret Handler to decode a value, set the handler name with smallrye.config.source.keystore."name".handler.

Configuration#

Configuration Property Type Default
smallrye.config.source.keystore."name".path
The KeyStore path.
String
smallrye.config.source.keystore."name".password
The KeyStore password.
String
smallrye.config.source.keystore."name".type
The KeyStore type.
String PKCS12
smallrye.config.source.keystore."name".handler
An Optional secret keys handler.
String
smallrye.config.source.keystore."name".aliases."key".name
An Optional aliases key name.
String
smallrye.config.source.keystore."name".aliases."key".password
An Optional aliases key password.
String
smallrye.config.source.keystore."name".aliases."key".handler
An Optional aliases key secret keys handler.
String