TrustManagerUtils
Date: 2016-06-23

org.apache.commons.net.util

## Class TrustManagerUtils

- java.lang.Object
- - org.apache.commons.net.util.TrustManagerUtils

-     public final class TrustManagerUtils
      extends java.lang.Object

  TrustManager utilities for generating TrustManagers.
  Since:
    3.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TrustManagerUtils()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static javax.net.ssl.X509TrustManager` | `getAcceptAllTrustManager()` Generate a TrustManager that performs no checks.
    `static javax.net.ssl.X509TrustManager` | `getDefaultTrustManager(java.security.KeyStore keyStore)` Return the default TrustManager provided by the JVM.
    `static javax.net.ssl.X509TrustManager` | `getValidateServerCertificateTrustManager()` Generate a TrustManager that checks server certificates for validity, but otherwise performs no checks.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TrustManagerUtils

          public TrustManagerUtils()

  - ### Method Detail

    - #### getAcceptAllTrustManager

          public static javax.net.ssl.X509TrustManager getAcceptAllTrustManager()

      Generate a TrustManager that performs no checks.
      Returns:
        the TrustManager

    - #### getValidateServerCertificateTrustManager

          public static javax.net.ssl.X509TrustManager getValidateServerCertificateTrustManager()

      Generate a TrustManager that checks server certificates for validity, but otherwise performs no checks.
      Returns:
        the validating TrustManager

    - #### getDefaultTrustManager

          public static javax.net.ssl.X509TrustManager getDefaultTrustManager(java.security.KeyStore keyStore)
                                                                       throws java.security.GeneralSecurityException

      Return the default TrustManager provided by the JVM.

      This should be the same as the default used by `SSLContext#init(KeyManager[], TrustManager[], SecureRandom)` when the TrustManager parameter is set to `null`

      Parameters:
        `keyStore` - the KeyStore to use, may be `null`
      Returns:
        the default TrustManager
      Throws:
        `java.security.GeneralSecurityException` - if an error occurs