Class TrustAllSocketFactory

  • All Implemented Interfaces:
    RMIClientSocketFactory

    public class TrustAllSocketFactory
    extends Object
    implements RMIClientSocketFactory
    Wrapper around an SSLSocketFactory that trusts all certificates. This is used for TLS protected RMI connections to prevent certificate errors. Furthermore, the class also allows to set custom values for the underlying TCP sockets read and connect timeouts. This is required for the portscan operation.
    Author:
    Tobias Neitzel (@qtc_de)
    • Constructor Detail

      • TrustAllSocketFactory

        public TrustAllSocketFactory()
        Creates a new TrustAllSocketFactory by disabling certificate validation on an SSLContext and using the resulting SSLSocketFactory. This constructor sets some default values for the read and connect timeouts that are used by the socket.
      • TrustAllSocketFactory

        public TrustAllSocketFactory​(int readTimeout,
                                     int connectTimeout)
        Same as the previous constructor, but allows user defined values for the timeouts. This can be handy when e.g. connecting to plain text sockets that do not return anything when receiving an incoming SSL handshake. The default behavior of an SSL socket is to hang forever in such a case.
        Parameters:
        readTimeout - timeout for read operations on the socket
        connectTimeout - timeout for the initial socket connect
    • Method Detail

      • getSSLSocketFactory

        public SSLSocketFactory getSSLSocketFactory()
        Can be used to obtain the underlying SSLSocketFactory
        Returns:
        SSLSocketFactory of the TrustAll context