java.lang.Object
io.helidon.common.pki.KeyConfig.KeystoreBuilder
- All Implemented Interfaces:
Builder<KeyConfig.Builder,
,KeyConfig> Supplier<KeyConfig>
- Enclosing class:
- KeyConfig
public static final class KeyConfig.KeystoreBuilder
extends Object
implements Builder<KeyConfig.Builder,KeyConfig>
Builder for resources from a java keystore (PKCS12, JKS etc.). Obtain an instance through
KeyConfig.keystoreBuilder()
.-
Method Summary
Modifier and TypeMethodDescriptionaddCertAlias
(String alias) Add an alias to list of aliases used to generate a trusted set of certificates.build()
Create an instance ofKeyConfig
based on this builder.Alias of X.509 certificate of public key.certChainAlias
(String alias) Alias of an X.509 chain.Update this builder from configuration.Alias of the private key in the keystore.keyPassphrase
(char[] privateKeyPassphrase) Pass-phrase of the key in the keystore (used for private keys).keyPassphrase
(String privateKeyPassphrase) Pass-phrase of the key in the keystore (used for private keys).Keystore resource definition.keystorePassphrase
(char[] keystorePassphrase) Pass-phrase of the keystore (supported with JKS and PKCS12 keystores).keystorePassphrase
(String keystorePassword) Pass-phrase of the keystore (supported with JKS and PKCS12 keystores).keystoreType
(String keystoreType) Set type of keystore.Create a builder forKeyConfig
from this keystore builder.If you want to build a trust store, call this method to add all certificates present in the keystore to certificate list.
-
Method Details
-
trustStore
If you want to build a trust store, call this method to add all certificates present in the keystore to certificate list.- Returns:
- updated builder instance
-
addCertAlias
Add an alias to list of aliases used to generate a trusted set of certificates.- Parameters:
alias
- alias of a certificate- Returns:
- updated builder instance
-
keystore
Keystore resource definition.- Parameters:
keystore
- keystore resource, from file path, classpath, URL etc.- Returns:
- updated builder instance
-
keystoreType
Set type of keystore. Defaults to "PKCS12", expected are other keystore types supported by java then can store keys under aliases.- Parameters:
keystoreType
- keystore type to load the key- Returns:
- updated builder instance
-
keystorePassphrase
Pass-phrase of the keystore (supported with JKS and PKCS12 keystores).- Parameters:
keystorePassphrase
- keystore pass-phrase- Returns:
- updated builder instance
-
keystorePassphrase
Pass-phrase of the keystore (supported with JKS and PKCS12 keystores).- Parameters:
keystorePassword
- keystore password to use, callskeystorePassphrase(char[])
- Returns:
- updated builder instance
-
keyAlias
Alias of the private key in the keystore.- Parameters:
keyAlias
- alias of the key in the keystore- Returns:
- updated builder instance
-
certAlias
Alias of X.509 certificate of public key. Used to load both the certificate and public key.- Parameters:
alias
- alias under which the certificate is stored in the keystore- Returns:
- updated builder instance
-
certChainAlias
Alias of an X.509 chain.- Parameters:
alias
- alias of certificate chain in the keystore- Returns:
- updated builder instance
-
keyPassphrase
Pass-phrase of the key in the keystore (used for private keys). This is (by default) the same as keystore passphrase - only configure if it differs from keystore passphrase.- Parameters:
privateKeyPassphrase
- pass-phrase of the key- Returns:
- updated builder instance
-
keyPassphrase
Pass-phrase of the key in the keystore (used for private keys). This is (by default) the same as keystore passphrase - only configure if it differs from keystore passphrase.- Parameters:
privateKeyPassphrase
- pass-phrase of the key- Returns:
- updated builder instance
-
build
Create an instance ofKeyConfig
based on this builder.- Specified by:
build
in interfaceBuilder<KeyConfig.Builder,
KeyConfig> - Returns:
- new key config based on a keystore
-
toFullBuilder
Create a builder forKeyConfig
from this keystore builder. This allows you to enhance the config with additional (explicit) fields.- Returns:
- builder of
KeyConfig
-
config
Update this builder from configuration. The following keys are expected under keykeystore
:resource
: resource configuration as understood byResource
type
: type of keystore (defaults to PKCS12)passphrase
: passphrase of keystore, if requiredkey.alias
: alias of private key, if wanted (defaults to "1")key.passphrase
: passphrase of private key if differs from keystore passphrasecert.alias
: alias of public certificate (to obtain public key)cert-chain.alias
: alias of certificate chaintrust-store
: true if this is a trust store (and we should load all certificates from it), defaults to false
- Parameters:
config
- configuration instance- Returns:
- updated builder instance
-