Package io.github.stevenjdh.simple.ssl
Class PEMContextBuilderImpl
java.lang.Object
io.github.stevenjdh.simple.ssl.PEMContextBuilderImpl
- All Implemented Interfaces:
PEMContext.Builder
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) char[]
(package private) Path
(package private) SimpleSSLContext.KeyStoreType
(package private) Path
(package private) char[]
(package private) Path
(package private) Path
(package private) char[]
(package private) Path
(package private) SimpleSSLContext.KeyStoreType
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Returns a newSSLContext
instance built from the current state of this builder.Optionally sets the keystore type being built with PKCS12 being the default.saveKeyStore
(Path keyMaterialPath, char[] password) Optionally saves the built keystore to the provided path, and protects its integrity with a password.saveTrustStore
(Path trustMaterialPath, char[] password) Optionally saves the built truststore to the provided path, and protects its integrity with a password.Optionally sets the truststore type being built with PKCS12 being the default.withPrivateKey
(Path keyPath, Path certPath) Optionally sets the keystore configuration using a Base64 encoded private key for building anSSLContext
.withPrivateKeyPassword
(char[] password) Optionally sets the password for the encrypted private key material.withPublicKey
(Path certPath) Optionally sets the truststore configuration using a Base64 encoded certificate or certificate chain for building anSSLContext
.
-
Field Details
-
publicKeyPath
Path publicKeyPath -
privateKeyPath
Path privateKeyPath -
privateKeyPassword
char[] privateKeyPassword -
privateKeyCertChainPath
Path privateKeyCertChainPath -
keyStorePath
Path keyStorePath -
keyStorePassword
char[] keyStorePassword -
trustStorePath
Path trustStorePath -
trustStorePassword
char[] trustStorePassword -
keyStoreType
SimpleSSLContext.KeyStoreType keyStoreType -
trustStoreType
SimpleSSLContext.KeyStoreType trustStoreType
-
-
Constructor Details
-
PEMContextBuilderImpl
PEMContextBuilderImpl()
-
-
Method Details
-
withPublicKey
Description copied from interface:PEMContext.Builder
Optionally sets the truststore configuration using a Base64 encoded certificate or certificate chain for building anSSLContext
.- Specified by:
withPublicKey
in interfacePEMContext.Builder
- Parameters:
certPath
- The path to the file containing one or more certificates.- Returns:
- This builder.
-
withPrivateKey
Description copied from interface:PEMContext.Builder
Optionally sets the keystore configuration using a Base64 encoded private key for building anSSLContext
.- Specified by:
withPrivateKey
in interfacePEMContext.Builder
- Parameters:
keyPath
- The path to the file containing the private key material.certPath
- The path to the file containing the certificate or certificate chain with the corresponding public key that pairs with the private key.- Returns:
- This builder.
-
withPrivateKeyPassword
Description copied from interface:PEMContext.Builder
Optionally sets the password for the encrypted private key material.- Specified by:
withPrivateKeyPassword
in interfacePEMContext.Builder
- Parameters:
password
- The password used to decrypt the encrypted key. If this is set to null or an empty char[], it will be assumed that decryption is not needed.- Returns:
- This builder.
-
saveKeyStore
Description copied from interface:PEMContext.Builder
Optionally saves the built keystore to the provided path, and protects its integrity with a password.- Specified by:
saveKeyStore
in interfacePEMContext.Builder
- Parameters:
keyMaterialPath
- The path used for saving the keystore.password
- The password to set when saving the keystore, which has a minimum length of 4 characters.- Returns:
- This builder.
-
saveTrustStore
Description copied from interface:PEMContext.Builder
Optionally saves the built truststore to the provided path, and protects its integrity with a password.- Specified by:
saveTrustStore
in interfacePEMContext.Builder
- Parameters:
trustMaterialPath
- The path used for saving the truststore.password
- The password to set when saving the truststore, which has a minimum length of 4 characters.- Returns:
- This builder.
-
keyStoreType
Description copied from interface:PEMContext.Builder
Optionally sets the keystore type being built with PKCS12 being the default.- Specified by:
keyStoreType
in interfacePEMContext.Builder
- Parameters:
type
- The keystore type such as PKCS12 or the legacy JKS.- Returns:
- This builder.
-
trustStoreType
Description copied from interface:PEMContext.Builder
Optionally sets the truststore type being built with PKCS12 being the default.- Specified by:
trustStoreType
in interfacePEMContext.Builder
- Parameters:
type
- The truststore type such as PKCS12 or the legacy JKS.- Returns:
- This builder.
-
build
Description copied from interface:PEMContext.Builder
Returns a newSSLContext
instance built from the current state of this builder.- Specified by:
build
in interfacePEMContext.Builder
- Returns:
- A new
SSLContext
.
-