Class SSLClientHelper
- java.lang.Object
-
- com.microstrategy.utils.certificate.SSLClientHelper
-
public class SSLClientHelper extends java.lang.Object
This utility class enables secure (TLS) connections to other services. Note that SSL has long been deprecated in favor of TLS (v1.2 and up) though in some cases we still retain the "SSL" in the name
SSLClientHelper
for compatibility much likeSSLSocketFactory
.Usage:
- Initialization. Before use please initialize with
TLSHelper.setTruststore(String, char[])
andTLSHelper.setKeystore(String, char[])
for self-signed and mutual/client certificate support. - Configuration. Create a new class with constructor
SSLClientHelper(String, int, Callback)
. Where aSSLSocketFactory
is obtained to actually send/receive data. - Connect. Invoke
clientConnectToServer()
will verifies connection to the server/port specified in the constructor, and depending on success/failure will invoke the appropriate method inSSLClientHelper.Callback
.
- See Also:
TLSHelper
- Initialization. Before use please initialize with
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SSLClientHelper.Callback
-
Constructor Summary
Constructors Constructor Description SSLClientHelper(java.lang.String serverFQDN, int serverPort, SSLClientHelper.Callback callback)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
clientConnectToServer()
Helper method to determine whether a secure connection can be made to a server at a specified port.static void
setKeystoreDetails(java.lang.String absPathToKeystore, char[] ksPassword)
Deprecated.static void
setTruststoreDetails(java.lang.String absPathToTruststore, char[] tsPassword)
Deprecated.static boolean
validatePath()
-
-
-
Constructor Detail
-
SSLClientHelper
public SSLClientHelper(java.lang.String serverFQDN, int serverPort, SSLClientHelper.Callback callback)
-
-
Method Detail
-
setTruststoreDetails
@Deprecated public static void setTruststoreDetails(java.lang.String absPathToTruststore, char[] tsPassword) throws java.lang.IllegalArgumentException, EncryptedObjectException
Deprecated.Sets the details about the trust store to be used.- Parameters:
absPathToTruststore
- Absolute path to the trust store filetsPassword
- Trust store password as char array.- Throws:
java.lang.IllegalArgumentException
- if the trust store path is null or emptyEncryptedObjectException
- if the EncryptedObject for the password encounters some problem
-
setKeystoreDetails
@Deprecated public static void setKeystoreDetails(java.lang.String absPathToKeystore, char[] ksPassword) throws java.lang.IllegalArgumentException, EncryptedObjectException
Deprecated.Sets the details about the client key store to be used. Note that the password array will be cleared before this method returns.- Parameters:
absPathToKeystore
- Absolute path to the key store fileksPassword
- Key store password as char array. Will be cleared before this method returns- Throws:
java.lang.IllegalArgumentException
- if the key store path is null or emptyEncryptedObjectException
- if the EncryptedObject for the password encounters some problem
-
validatePath
public static boolean validatePath() throws java.io.IOException
- Throws:
java.io.IOException
-
clientConnectToServer
public void clientConnectToServer()
Helper method to determine whether a secure connection can be made to a server at a specified port. Connection details are provided during instantiation. Note that this method does not automatically connect to the server. It requires a callback instance to report success or failure.
-
-