Class TrustManagers


  • public final class TrustManagers
    extends Object
    This class contains methods for creating common types of trust manager.
    • Method Detail

      • checkUsingKeyStoreFile

        public static X509TrustManager checkUsingKeyStoreFile​(String file,
                                                              char[] password,
                                                              String type)
                                                       throws GeneralSecurityException,
                                                              IOException
        Creates a new X509TrustManager which will use the named trust store file to determine whether to trust a certificate. It will use the provided trust store type and password.
        Parameters:
        file - The trust store file name.
        password - The trust store password, which may be null.
        type - The trust store type, which may be null to indicate that the default trust store type for the JVM (e.g. KeyManagers.JKS) should be used.
        Returns:
        A new X509TrustManager which will use the named trust store file to determine whether to trust a certificate.
        Throws:
        GeneralSecurityException - If the trust store could not be loaded, perhaps due to incorrect type, or missing algorithms.
        IOException - If the trust store file could not be found or could not be read.
        NullPointerException - If provided file was null.
      • trustAll

        public static X509ExtendedTrustManager trustAll()
        Returns an X509ExtendedTrustManager which trusts all certificates.
        Returns:
        An X509ExtendedTrustManager which trusts all certificates.