Class RpcSSLSocketFactory.TrustAllTrustManager

  • All Implemented Interfaces:
    javax.net.ssl.TrustManager, javax.net.ssl.X509TrustManager
    Enclosing class:
    RpcSSLSocketFactory

    public static class RpcSSLSocketFactory.TrustAllTrustManager
    extends java.lang.Object
    implements javax.net.ssl.X509TrustManager
    This class allow any X509 certificates to be used to authenticate the remote side of a secure socket, including self-signed certificates.

    Note that the tradeoff of this convenience usage is the vulnerability of man-in-the-middle attacks.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void checkClientTrusted​(java.security.cert.X509Certificate[] chain, java.lang.String authType)
      Always trust for client SSL chain peer certificate chain with any authType authentication types.
      void checkServerTrusted​(java.security.cert.X509Certificate[] chain, java.lang.String authType)
      Always trust for server SSL chain peer certificate chain with any authType exchange algorithm types.
      java.security.cert.X509Certificate[] getAcceptedIssuers()
      Return an empty array of certificate authority certificates which are trusted for authenticating peers.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TrustAllTrustManager

        public TrustAllTrustManager()
    • Method Detail

      • checkClientTrusted

        public void checkClientTrusted​(java.security.cert.X509Certificate[] chain,
                                       java.lang.String authType)
        Always trust for client SSL chain peer certificate chain with any authType authentication types.
        Specified by:
        checkClientTrusted in interface javax.net.ssl.X509TrustManager
        Parameters:
        chain - the peer certificate chain.
        authType - the authentication type based on the client certificate.
      • checkServerTrusted

        public void checkServerTrusted​(java.security.cert.X509Certificate[] chain,
                                       java.lang.String authType)
        Always trust for server SSL chain peer certificate chain with any authType exchange algorithm types.
        Specified by:
        checkServerTrusted in interface javax.net.ssl.X509TrustManager
        Parameters:
        chain - the peer certificate chain.
        authType - the key exchange algorithm used.
      • getAcceptedIssuers

        public java.security.cert.X509Certificate[] getAcceptedIssuers()
        Return an empty array of certificate authority certificates which are trusted for authenticating peers.
        Specified by:
        getAcceptedIssuers in interface javax.net.ssl.X509TrustManager
        Returns:
        a empty array of issuer certificates.