public class TLSContext
extends java.lang.Object
This defines the operations or actions for establishing a TLS Version 1 based context.
Uses the maintenance, debug, support and user level loggers.
| Constructor and Description |
|---|
TLSContext(java.lang.String truststore,
java.lang.String trustpass)
Instantiates a new TLS context.
|
TLSContext(java.lang.String keystore,
java.lang.String keypass,
java.lang.String truststore,
java.lang.String trustpass,
java.lang.String type,
java.lang.String algorithm,
java.lang.String protocol)
Instantiates a new TLS context.
|
| Modifier and Type | Method and Description |
|---|---|
javax.net.ssl.HttpsURLConnection |
createHttpsUrlConnection(java.lang.String url,
java.lang.Integer connectionTimeout)
Creates a Https connection to the specified URL connection.
|
javax.net.ssl.SSLSocket |
createSocket(java.lang.String host,
int port,
int soTimeout)
Creates an SSL Socket to be used in a session.
|
java.lang.String |
getCertificateCommonName() |
public TLSContext(java.lang.String keystore,
java.lang.String keypass,
java.lang.String truststore,
java.lang.String trustpass,
java.lang.String type,
java.lang.String algorithm,
java.lang.String protocol)
throws KeyStoreNotFoundException,
KeyStoreReadException,
java.security.KeyStoreException,
java.security.cert.CertificateException,
java.security.UnrecoverableKeyException,
java.security.NoSuchAlgorithmException,
java.security.KeyManagementException
keystore - the filename of the key store to be used for the contextkeypass - the password applied to the key storetruststore - the filename of the trust store that is to be used for the key storetrustpass - the password used in the trust storetype - the key store typealgorithm - the algorithmKeyStoreNotFoundException - the key store not found exceptionKeyStoreReadException - the key store read exceptionjava.security.KeyStoreException - the key store exceptionjava.security.cert.CertificateException - the certificate exceptionjava.security.UnrecoverableKeyException - the unrecoverable key exceptionjava.security.NoSuchAlgorithmException - the no such algorithm exceptionjava.security.KeyManagementException - the key management exceptionpublic TLSContext(java.lang.String truststore,
java.lang.String trustpass)
throws java.security.cert.CertificateException,
java.security.UnrecoverableKeyException,
java.security.NoSuchAlgorithmException,
java.security.KeyStoreException,
java.security.KeyManagementException,
KeyStoreReadException,
KeyStoreNotFoundException
truststore - the filename of the trust store that is to be used for the key storetrustpass - the password used in the trust storeKeyStoreNotFoundException - the key store not found exceptionKeyStoreReadException - the key store read exceptionjava.security.KeyStoreException - the key store exceptionjava.security.cert.CertificateException - the certificate exceptionjava.security.UnrecoverableKeyException - the unrecoverable key exceptionjava.security.NoSuchAlgorithmException - the no such algorithm exceptionjava.security.KeyManagementException - the key management exceptionpublic java.lang.String getCertificateCommonName()
public javax.net.ssl.SSLSocket createSocket(java.lang.String host,
int port,
int soTimeout)
throws java.io.IOException,
javax.net.ssl.SSLHandshakeException
host - the hostport - the portsoTimeout - the socket timeoutjava.io.IOException - Signals that an I/O exception has occurred.javax.net.ssl.SSLHandshakeException - the SSL handshake exceptionpublic javax.net.ssl.HttpsURLConnection createHttpsUrlConnection(java.lang.String url,
java.lang.Integer connectionTimeout)
throws java.io.IOException
url - the URL to establish a HTTPS connection toconnectionTimeout - connection timeout value to be used in millisecondsjava.io.IOException - in case of a malformed URL or an IO exception occurring while trying to open a connection