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 newSSLContextinstance 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.BuilderOptionally sets the truststore configuration using a Base64 encoded certificate or certificate chain for building anSSLContext.- Specified by:
withPublicKeyin interfacePEMContext.Builder- Parameters:
certPath- The path to the file containing one or more certificates.- Returns:
- This builder.
-
withPrivateKey
Description copied from interface:PEMContext.BuilderOptionally sets the keystore configuration using a Base64 encoded private key for building anSSLContext.- Specified by:
withPrivateKeyin 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.BuilderOptionally sets the password for the encrypted private key material.- Specified by:
withPrivateKeyPasswordin 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.BuilderOptionally saves the built keystore to the provided path, and protects its integrity with a password.- Specified by:
saveKeyStorein 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.BuilderOptionally saves the built truststore to the provided path, and protects its integrity with a password.- Specified by:
saveTrustStorein 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.BuilderOptionally sets the keystore type being built with PKCS12 being the default.- Specified by:
keyStoreTypein interfacePEMContext.Builder- Parameters:
type- The keystore type such as PKCS12 or the legacy JKS.- Returns:
- This builder.
-
trustStoreType
Description copied from interface:PEMContext.BuilderOptionally sets the truststore type being built with PKCS12 being the default.- Specified by:
trustStoreTypein interfacePEMContext.Builder- Parameters:
type- The truststore type such as PKCS12 or the legacy JKS.- Returns:
- This builder.
-
build
Description copied from interface:PEMContext.BuilderReturns a newSSLContextinstance built from the current state of this builder.- Specified by:
buildin interfacePEMContext.Builder- Returns:
- A new
SSLContext.
-