java.lang.Object
io.helidon.common.pki.KeyConfig.PemBuilder
- All Implemented Interfaces:
io.helidon.common.Builder<KeyConfig.Builder,,KeyConfig> Supplier<KeyConfig>
- Enclosing class:
- KeyConfig
public static final class KeyConfig.PemBuilder
extends Object
implements io.helidon.common.Builder<KeyConfig.Builder,KeyConfig>
Builder for PEM files - accepts private key and certificate chain. Obtain an instance through
KeyConfig.pemBuilder().
If you have "standard" linux/unix private key, you must run "
openssl pkcs8 -topk8 -in ./id_rsa -out ./id_rsa.p8" on it to work with this builder for password protected
file; or "openssl pkcs8 -topk8 -in ./id_rsa -out ./id_rsa_nocrypt.p8 -nocrypt" for unprotected file.
The only supported format is PKCS#8. If you have a different format, you must to transform it to PKCS8 PEM format (to
use this builder), or to PKCS#12 keystore format (and use KeyConfig.KeystoreBuilder).-
Method Summary
Modifier and TypeMethodDescriptionbuild()BuildKeyConfigbased on information from PEM files only.Load certificate chain from PEM resource.certificates(Resource resource) Read one or more certificates in PEM format from a resource definition.config(io.helidon.config.Config config) Update this builder from configuration.Read a private key from PEM format from a resource definition.keyPassphrase(char[] passphrase) Passphrase for private key.keyPassphrase(String passphrase) Passphrase for private key.Read a public key from PEM format from a resource definition.Get a builder filled from this builder to add additional information (such as public key from certificate etc.).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.helidon.common.Builder
get, identity, update
-
Method Details
-
key
Read a private key from PEM format from a resource definition.- Parameters:
resource- key resource (file, classpath, URL etc.)- Returns:
- updated builder instance
-
publicKey
Read a public key from PEM format from a resource definition.- Parameters:
resource- key resource (file, classpath, URL etc.)- Returns:
- updated builder instance
-
keyPassphrase
Passphrase for private key. If the key is encrypted (and in PEM PKCS#8 format), this passphrase will be used to decrypt it.- Parameters:
passphrase- passphrase used to encrypt the private key- Returns:
- updated builder instance
-
keyPassphrase
Passphrase for private key. If the key is encrypted (and in PEM PKCS#8 format), this passphrase will be used to decrypt it.- Parameters:
passphrase- passphrase used to encrypt the private key- Returns:
- updated builder instance
-
certChain
Load certificate chain from PEM resource.- Parameters:
resource- resource (e.g. classpath, file path, URL etc.)- Returns:
- updated builder instance
-
certificates
Read one or more certificates in PEM format from a resource definition. Used eg: in a trust store.- Parameters:
resource- key resource (file, classpath, URL etc.)- Returns:
- updated builder instance
-
build
BuildKeyConfigbased on information from PEM files only.- Specified by:
buildin interfaceio.helidon.common.Builder<KeyConfig.Builder,KeyConfig> - Returns:
- new instance configured from this builder
-
toFullBuilder
Get a builder filled from this builder to add additional information (such as public key from certificate etc.).- Returns:
- builder for
KeyConfig
-
config
Update this builder from configuration. Expected keys:- pem-key-path - path to PEM private key file (PKCS#8 format)
- pem-key-resource-path - path to resource on classpath
- pem-key-passphrase - passphrase of private key if encrypted
- pem-cert-chain-path - path to certificate chain PEM file
- pem-cert-chain-resource-path - path to resource on classpath
- Parameters:
config- configuration to update builder from- Returns:
- updated builder instance
-