Class TrustManagerTrustAll

java.lang.Object
com.helger.http.security.TrustManagerTrustAll
All Implemented Interfaces:
TrustManager, X509TrustManager

public class TrustManagerTrustAll extends Object implements X509TrustManager
A trust manager that accepts all certificates.
Author:
Philip Helger
  • Constructor Details

    • TrustManagerTrustAll

      public TrustManagerTrustAll()
      Constructor using the current debug mode from GlobalDebug.
    • TrustManagerTrustAll

      public TrustManagerTrustAll(boolean bDebug)
      Constructor with explicit debug flag.
      Parameters:
      bDebug - true to enable debug logging, false to disable it.
  • Method Details

    • isDebug

      public boolean isDebug()
      Returns:
      The debug flag as passed in the constructor.
    • getAcceptedIssuers

      public @Nullable X509Certificate[] getAcceptedIssuers()
      Specified by:
      getAcceptedIssuers in interface X509TrustManager
      Returns:
      Always null since all issuers are accepted.
    • checkServerTrusted

      public void checkServerTrusted(X509Certificate[] aChain, String sAuthType)
      This implementation trusts all server certificates.
      Specified by:
      checkServerTrusted in interface X509TrustManager
      Parameters:
      aChain - The peer certificate chain. May not be null.
      sAuthType - The authentication type based on the server certificate. May not be null.
    • checkClientTrusted

      public void checkClientTrusted(X509Certificate[] aChain, String sAuthType)
      This implementation trusts all client certificates.
      Specified by:
      checkClientTrusted in interface X509TrustManager
      Parameters:
      aChain - The peer certificate chain. May not be null.
      sAuthType - The key exchange algorithm used. May not be null.
    • toString

      public String toString()
      Overrides:
      toString in class Object