public class TLSConnectionBuilder extends Object
| Constructor and Description |
|---|
TLSConnectionBuilder(String trustStoreFilename,
String trustStorePassword)
Constructor for one way server authentication.
|
TLSConnectionBuilder(String trustStoreFilename,
String trustStorePassword,
String keyStoreFilename,
String keyStorePassword)
Constructor for 2 way secure TLS connection using a trust store (with associated password) to verify the server certificate
and a keystore (with password) to pass back to the server for server-based mutual certificate trust authentication
|
| Modifier and Type | Method and Description |
|---|---|
org.apache.http.impl.client.CloseableHttpClient |
configureSSLConnection()
Builds and configures the TLS connection based on the available set-up parameters
|
SSLContext |
createAndPopulateContext()
Builds and configures the sslContext using the class properties and settings
|
String |
getKeyStoreFile() |
String |
getKeyStorePassword() |
String |
getTrustStoreFile() |
String |
getTrustStorePassword() |
public TLSConnectionBuilder(String trustStoreFilename, String trustStorePassword, String keyStoreFilename, String keyStorePassword)
trustStoreFilename - - relative or fully qualified path and name of the trust storetrustStorePassword - - trust store passwordkeyStoreFilename - - relative or fully qualified path and name of the key storekeyStorePassword - - the key store passwordpublic TLSConnectionBuilder(String trustStoreFilename, String trustStorePassword)
trustStoreFilename - - relative or fully qualified path and name of the trust storetrustStorePassword - - trust store passwordpublic SSLContext createAndPopulateContext() throws NoSuchAlgorithmException, KeyStoreException, TLSGeneralException, IOException, CertificateException, UnrecoverableKeyException, KeyManagementException
If the keystore file path or the truststore file path are null or empty they will not be included as part of the SSL context setup. If the path is not null it will be checked for validity with a TLS exception being thrown if the path does not point to a real file.
KeyStoreException - - keystore is not correctly configuredIOException - - truststore/keystore files do not existCertificateException - - bad certNoSuchAlgorithmException - - bad certUnrecoverableKeyException - - keystore internal errorKeyManagementException - - general keystore exceptionTLSGeneralException - - TLSConnectionBuilder exceptionpublic org.apache.http.impl.client.CloseableHttpClient configureSSLConnection()
throws KeyStoreException,
IOException,
CertificateException,
NoSuchAlgorithmException,
UnrecoverableKeyException,
KeyManagementException,
TLSGeneralException
If the keystore file path or the truststore file path are null or empty they will not be included as part of the SSL context setup. If the path is not null it will be checked for validity with a TLS exception being thrown if the path does not point to a real file. s
KeyStoreException - - keystore is not correctly configuredIOException - - truststore/keystore files do not existCertificateException - - bad certNoSuchAlgorithmException - - bad certUnrecoverableKeyException - - keystore internal errorKeyManagementException - - general keystore exceptionTLSGeneralException - - TLSConnectionBuilder exceptionpublic String getTrustStoreFile()
public String getTrustStorePassword()
public String getKeyStorePassword()
public String getKeyStoreFile()
Copyright © 2018. All rights reserved.