public class EntrustSSLSocketFactory
extends javax.net.ssl.SSLSocketFactory
SSLSocketFactory class
will be enabled. If strong cryptographic algorithms are allowed, a stronger set of cipher
suites will also be enabled.EntrustHostnameVerifier,
HandshakeCompleteInfo| Modifier and Type | Class and Description |
|---|---|
static class |
EntrustSSLSocketFactory.InetHandling
Define Enumeration for Inet Handling
|
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_SSL_PROVIDER |
| Constructor and Description |
|---|
EntrustSSLSocketFactory(javax.net.ssl.TrustManager[] tms,
javax.net.ssl.KeyManager[] kms,
java.security.SecureRandom sr)
Initializes an EntrustSSLSocketFactory from an array of TrustManagers,
an array of KeyManagers, and a Secure random number generator.
|
EntrustSSLSocketFactory(javax.net.ssl.TrustManager[] tms,
javax.net.ssl.KeyManager[] kms,
java.security.SecureRandom sr,
java.lang.String provider)
Initializes an EntrustSSLSocketFactory from an array of TrustManagers,
an array of KeyManagers, and a Secure random number generator.
|
| Modifier and Type | Method and Description |
|---|---|
java.net.Socket |
createSocket()
Creates an unconnected SSLSocket.
|
java.net.Socket |
createSocket(java.net.InetAddress inaddr,
int port)
Creates a socket and connects it to the specified port number at the specified address.
|
java.net.Socket |
createSocket(java.net.InetAddress address,
int port,
java.net.InetAddress localhost,
int localport)
Creates a socket and connects it to the specified remote host on the specified remote port.
|
java.net.Socket |
createSocket(java.net.Socket socket,
java.lang.String hostname,
int port,
boolean autoclose)
Returns a socket layered over an existing socket connected to the named host, at the given port.
|
java.net.Socket |
createSocket(java.lang.String hostname,
int port)
Create the SSLSocket.
|
java.net.Socket |
createSocket(java.lang.String hostname,
int port,
java.net.InetAddress localhost,
int localport)
Creates an SSLSocket and connects it to the specified remote host on the specified
remote port.
|
static javax.net.SocketFactory |
getDefault()
Get the default socket from a static instance.
|
java.lang.String[] |
getDefaultCipherSuites()
Returns the defaultCipherSuites used by this SSLSocket
|
EntrustSSLSocketFactory.InetHandling |
getInetAddressHandling()
Return how the socket should be configured when created with
an InetAddress.
|
java.lang.String[] |
getProtocols()
Gets the supported protocols
|
java.lang.String[] |
getSupportedCipherSuites()
Returns the Supported Ciphersuites
|
static EntrustSSLSocketFactory.InetHandling |
readInetHandlingProperty()
Reads the system property com.entrust.toolkit.x509.directory.EntrustSSLSocketFactory.InetHandling
|
static void |
setDefault(javax.net.ssl.X509TrustManager tm,
javax.net.ssl.X509KeyManager km,
java.security.SecureRandom random,
java.lang.String provider)
Set the X509TrustManager, X509KeyManager and SecureRandom which should be used
by the static call to
getDefault(). |
void |
setEnabledCipherSuites(java.lang.String[] ciphers)
Sets the Cipher Suites which should be used.
|
void |
setHostnameVerifier(javax.net.ssl.HostnameVerifier verifier)
Allows the end user to set a custom HostnameVerifier.
|
void |
setInetAddressHandling(EntrustSSLSocketFactory.InetHandling handling)
This API allows the socket to be configured with how a Socket created
with the InetAddress class should be handled.
|
void |
setProtocols(java.lang.String[] protocols)
Sets the supported protocols.
|
public static final java.lang.String DEFAULT_SSL_PROVIDER
public EntrustSSLSocketFactory(javax.net.ssl.TrustManager[] tms,
javax.net.ssl.KeyManager[] kms,
java.security.SecureRandom sr,
java.lang.String provider)
tms - the TrustManagerskms - the KeyManagerssr - the SecureRandomprovider - the providerpublic EntrustSSLSocketFactory(javax.net.ssl.TrustManager[] tms,
javax.net.ssl.KeyManager[] kms,
java.security.SecureRandom sr)
tms - the TrustManagerskms - the KeyManagerssr - The SecureRandompublic static EntrustSSLSocketFactory.InetHandling readInetHandlingProperty() throws java.net.SocketException
java.net.SocketExceptionpublic static javax.net.SocketFactory getDefault()
Note this class gets the key material for the LDAPSTrustManager by using the LDAPSTrustStoreSingleton
object. If no key material has been supplied, then the LDAPS connection will fail.
java.security.cert.CertificateExceptionCertificationRootExceptionpublic static void setDefault(javax.net.ssl.X509TrustManager tm,
javax.net.ssl.X509KeyManager km,
java.security.SecureRandom random,
java.lang.String provider)
getDefault().tm - The X509TrustManagerkm - The X509KeyManagerrandom - The SecureRandomprovider - The provider namepublic java.net.Socket createSocket(java.net.Socket socket,
java.lang.String hostname,
int port,
boolean autoclose)
throws java.io.IOException
Hostname verification will be performed using the EntrustHostnameVerifier.
A HandshakeCompleteInfo listener object is also registered using the SSLSocket's
addHandshakeCompleteListener(). This can be used to determine information about the socket
that was used to create the SSL connection.
createSocket in class javax.net.ssl.SSLSocketFactorysocket - The existing sockethostname - the hostname of the SSL serverport - the port of the SSL serverautoclose - true indicates the underlying socket should be closed when this socket is closed, false
indicates the underlying socket should not be closed.java.io.IOExceptionpublic java.net.Socket createSocket(java.net.InetAddress address,
int port,
java.net.InetAddress localhost,
int localport)
throws java.io.IOException
Hostname verification will be performed using the EntrustHostnameVerifier.
A HandshakeCompleteInfo listener object is also registered using the SSLSocket's
addHandshakeCompleteListener(). This can be used to determine information about the socket
that was used to create the SSL connection.
createSocket in class javax.net.SocketFactoryaddress - The IP addressport - the port of the SSL serverlocalhost - IP address of the local hostlocalport - The local portjava.io.IOExceptionpublic java.net.Socket createSocket(java.net.InetAddress inaddr,
int port)
throws java.io.IOException
Hostname verification will be performed using the EntrustHostnameVerifier.
A HandshakeCompleteInfo listener object is also registered using the SSLSocket's
addHandshakeCompleteListener(). This can be used to determine information about the socket
that was used to create the SSL connection.
createSocket in class javax.net.SocketFactoryinaddr - The inet address of the SSL serverport - the port of the SSL serverjava.io.IOExceptionpublic java.net.Socket createSocket(java.lang.String hostname,
int port,
java.net.InetAddress localhost,
int localport)
throws java.io.IOException
EntrustHostnameVerifier.
A HandshakeCompleteInfo listener object is also registered using the SSLSocket's
addHandshakeCompleteListener(). This can be used to determine information about the socket
that was used to create the SSL connection.createSocket in class javax.net.SocketFactoryjava.io.IOExceptionpublic java.net.Socket createSocket()
throws java.io.IOException
createSocket in class javax.net.SocketFactoryjava.io.IOExceptionpublic java.net.Socket createSocket(java.lang.String hostname,
int port)
throws java.io.IOException
EntrustHostnameVerifier. A HandshakeCompleteInfo listener
object is also registered using the SSLSocket's addHandshakeCompleteListener().
This can be used to determine information about the socket that was used to
create the SSL connection.createSocket in class javax.net.SocketFactoryhostname - The hostname of the SSL server which will be used to make the
connectionport - the port number of the SSL serverjava.io.IOExceptionHandshakeCompleteInfopublic java.lang.String[] getDefaultCipherSuites()
getDefaultCipherSuites in class javax.net.ssl.SSLSocketFactorypublic java.lang.String[] getSupportedCipherSuites()
getSupportedCipherSuites in class javax.net.ssl.SSLSocketFactorypublic void setEnabledCipherSuites(java.lang.String[] ciphers)
ciphers - the list of cipher suites which should be used by this class.public void setInetAddressHandling(EntrustSSLSocketFactory.InetHandling handling)
public enum InetHandling {HOSTNAME, IPADDRESS, REJECT, COMPAT}
Note, if the HOSTNAME or IPADDRESS setting is used, it will be up to the client application to enforce that InetAddress objects are created with that type of object. Failure to do so may result in a DNS lookup which makes the implementation vulnerable to DNS attacks.
Note: Using a hostname to create the socket is always safe.handling - enumerated type.public EntrustSSLSocketFactory.InetHandling getInetAddressHandling() throws java.io.IOException
This will be the value set using the setInetAddressHandling(InetHandling) or
the default value which is defined in the System property
com.entrust.toolkit.x509.directory.EntrustSSLSocketFactory.InetHandling variable
REJECT which will throw an exception
HOSTNAME which will assume InetAddress is created with a hostname
IPADDRESS which will assume InetAddress is created with an IP
COMPAT - Compatible with previous versions of the toolkit. Uses Session.getPeerHost
to lookup the hostname
java.io.IOException - if inetHandling has not been set and the default
value set using the system property is set incorrectlypublic void setHostnameVerifier(javax.net.ssl.HostnameVerifier verifier)
Note: Setting this value to null will turn off hostname verification
verifier - the custom HostnameVerifier to be setpublic java.lang.String[] getProtocols()
public void setProtocols(java.lang.String[] protocols)
protocols - the supported protocols to set