Class NullTrustManager

  • All Implemented Interfaces:
    java.io.Serializable, javax.net.ssl.TrustManager, javax.net.ssl.X509TrustManager

    @NotMutable
    @ThreadSafety(level=COMPLETELY_THREADSAFE)
    public final class NullTrustManager
    extends java.lang.Object
    implements javax.net.ssl.X509TrustManager, java.io.Serializable
    This class provides an SSL trust manager that will not trust any certificates. It is primarily useful for testing purposes.
    See Also:
    Serialized Form
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void checkClientTrusted​(java.security.cert.X509Certificate[] chain, java.lang.String authType)
      Checks to determine whether the provided client certificate chain should be trusted.
      void checkServerTrusted​(java.security.cert.X509Certificate[] chain, java.lang.String authType)
      Checks to determine whether the provided server certificate chain should be trusted.
      java.security.cert.X509Certificate[] getAcceptedIssuers()
      Retrieves the accepted issuer certificates for this trust manager.
      static NullTrustManager getInstance()
      Retrieves the singleton instance of this class.
      • Methods inherited from class java.lang.Object

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

      • checkClientTrusted

        public void checkClientTrusted​(@NotNull
                                       java.security.cert.X509Certificate[] chain,
                                       @NotNull
                                       java.lang.String authType)
                                throws java.security.cert.CertificateException
        Checks to determine whether the provided client certificate chain should be trusted. A certificate will only be rejected (by throwing a CertificateException) if certificate validity dates should be examined and the certificate or any of its issuers is outside of the validity window.
        Specified by:
        checkClientTrusted in interface javax.net.ssl.X509TrustManager
        Parameters:
        chain - The client certificate chain for which to make the determination.
        authType - The authentication type based on the client certificate.
        Throws:
        java.security.cert.CertificateException - If the provided client certificate chain should not be trusted.
      • checkServerTrusted

        public void checkServerTrusted​(@NotNull
                                       java.security.cert.X509Certificate[] chain,
                                       @NotNull
                                       java.lang.String authType)
                                throws java.security.cert.CertificateException
        Checks to determine whether the provided server certificate chain should be trusted. A certificate will only be rejected (by throwing a CertificateException) if certificate validity dates should be examined and the certificate or any of its issuers is outside of the validity window.
        Specified by:
        checkServerTrusted in interface javax.net.ssl.X509TrustManager
        Parameters:
        chain - The server certificate chain for which to make the determination.
        authType - The key exchange algorithm used.
        Throws:
        java.security.cert.CertificateException - If the provided server certificate chain should not be trusted.
      • getAcceptedIssuers

        @NotNull
        public java.security.cert.X509Certificate[] getAcceptedIssuers()
        Retrieves the accepted issuer certificates for this trust manager. This will always return an empty array.
        Specified by:
        getAcceptedIssuers in interface javax.net.ssl.X509TrustManager
        Returns:
        The accepted issuer certificates for this trust manager.