public class

SSLCertificateSocketFactory

extends SSLSocketFactory
java.lang.Object
   ↳ javax.net.SocketFactory
     ↳ javax.net.ssl.SSLSocketFactory
       ↳ android.net.SSLCertificateSocketFactory

Class Overview

SSLSocketFactory that provides optional (on debug devices, only) skipping of ssl certificfate chain validation and custom read timeouts used just when connecting to the server/negotiating an ssl session. You can skip the ssl certificate checking at runtime by setting socket.relaxsslcheck=yes on devices that do not have have ro.secure set.

Summary

Public Constructors
SSLCertificateSocketFactory(int socketReadTimeoutForSslHandshake)
Do not use this constructor (will be deprecated).
Public Methods
Socket createSocket(String s, int i)
Creates a new socket which is connected to the remote host specified by the parameters host and port.
Socket createSocket(InetAddress inaddr, int i, InetAddress inaddr2, int j)
Creates a new socket which is connected to the remote host specified by the InetAddress address.
Socket createSocket(String s, int i, InetAddress inaddr, int j)
Creates a new socket which is connected to the remote host specified by the parameters host and port.
Socket createSocket(InetAddress inaddr, int i)
Creates a new socket which is connected to the remote host specified by the InetAddress host.
Socket createSocket(Socket socket, String s, int i, boolean flag)
Creates an SSLSocket over the specified socket that is connected to the specified host at the specified port.
static SocketFactory getDefault(int socketReadTimeoutForSslHandshake)
Returns a new instance of a socket factory using the specified socket read timeout while connecting with the server/negotiating an ssl session.
String[] getDefaultCipherSuites()
Returns the names of the cipher suites that are enabled by default.
String[] getSupportedCipherSuites()
Returns the names of the cipher suites that are supported and could be enabled for an SSL connection.
[Expand]
Inherited Methods
From class javax.net.ssl.SSLSocketFactory
From class javax.net.SocketFactory
From class java.lang.Object

Public Constructors

public SSLCertificateSocketFactory (int socketReadTimeoutForSslHandshake)

Do not use this constructor (will be deprecated). Use getDefault(int) instead.

Public Methods

public Socket createSocket (String s, int i)

Creates a new socket which is connected to the remote host specified by the parameters host and port. The socket is bound to any available local address and port.

Parameters
s the remote host address the socket has to be connected to.
i the port number of the remote host at which the socket is connected.
Returns
  • the created connected socket.
Throws
IOException

public Socket createSocket (InetAddress inaddr, int i, InetAddress inaddr2, int j)

Creates a new socket which is connected to the remote host specified by the InetAddress address. The socket is bound to the local network interface specified by the InetAddress localHost on port localPort.

Parameters
inaddr the remote host address the socket has to be connected to.
i the port number of the remote host at which the socket is connected.
inaddr2 the local host address the socket is bound to.
j the port number of the local host at which the socket is bound.
Returns
  • the created connected socket.
Throws
IOException

public Socket createSocket (String s, int i, InetAddress inaddr, int j)

Creates a new socket which is connected to the remote host specified by the parameters host and port. The socket is bound to the local network interface specified by the InetAddress localHost on port localPort.

Parameters
s the remote host address the socket has to be connected to.
i the port number of the remote host at which the socket is connected.
inaddr the local host address the socket is bound to.
j the port number of the local host at which the socket is bound.
Returns
  • the created connected socket.
Throws
IOException

public Socket createSocket (InetAddress inaddr, int i)

Creates a new socket which is connected to the remote host specified by the InetAddress host. The socket is bound to any available local address and port.

Parameters
inaddr the host address the socket has to be connected to.
i the port number of the remote host at which the socket is connected.
Returns
  • the created connected socket.
Throws
IOException

public Socket createSocket (Socket socket, String s, int i, boolean flag)

Creates an SSLSocket over the specified socket that is connected to the specified host at the specified port.

Parameters
socket the socket.
s the host.
i the port number.
flag true if socket s should be closed when the created socket is closed, false if the socket s should be left open.
Returns
  • the creates ssl socket.
Throws
IOException

public static SocketFactory getDefault (int socketReadTimeoutForSslHandshake)

Returns a new instance of a socket factory using the specified socket read timeout while connecting with the server/negotiating an ssl session.

Parameters
socketReadTimeoutForSslHandshake the socket read timeout used for performing ssl handshake. The socket read timeout is set back to 0 after the handshake.
Returns
  • a new SocketFactory, or null on error

public String[] getDefaultCipherSuites ()

Returns the names of the cipher suites that are enabled by default.

Returns
  • the names of the cipher suites that are enabled by default.

public String[] getSupportedCipherSuites ()

Returns the names of the cipher suites that are supported and could be enabled for an SSL connection.

Returns
  • the names of the cipher suites that are supported.