Class JVMDefaultTrustManager

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

    @NotMutable
    @ThreadSafety(level=COMPLETELY_THREADSAFE)
    public final class JVMDefaultTrustManager
    extends java.lang.Object
    implements javax.net.ssl.X509TrustManager, java.io.Serializable
    This class provides an implementation of a trust manager that relies on the JVM's default set of trusted issuers. This is generally found in the jre/lib/security/cacerts or lib/security/cacerts file in the Java installation (in both Sun/Oracle and IBM-based JVMs), but if neither of those files exist (or if they cannot be parsed as a JKS or PKCS#12 keystore), then we will search for the file below the Java home directory.
    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.
      java.io.File getCACertsFile()
      Retrieves the path to the the file containing the JVM's default set of trusted issuers.
      static JVMDefaultTrustManager getInstance()
      Retrieves the singleton instance of this trust manager.
      java.util.Collection<java.security.cert.X509Certificate> getTrustedIssuerCertificates()
      Retrieves the certificates included in this trust manager.
      • Methods inherited from class java.lang.Object

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

      • getInstance

        public static JVMDefaultTrustManager getInstance()
        Retrieves the singleton instance of this trust manager.
        Returns:
        The singleton instance of this trust manager.
      • getCACertsFile

        public java.io.File getCACertsFile()
                                    throws java.security.cert.CertificateException
        Retrieves the path to the the file containing the JVM's default set of trusted issuers.
        Returns:
        The path to the file containing the JVM's default set of trusted issuers.
        Throws:
        java.security.cert.CertificateException - If a problem was encountered while initializing this trust manager.
      • getTrustedIssuerCertificates

        public java.util.Collection<java.security.cert.X509Certificate> getTrustedIssuerCertificates()
                                                                                              throws java.security.cert.CertificateException
        Retrieves the certificates included in this trust manager.
        Returns:
        The certificates included in this trust manager.
        Throws:
        java.security.cert.CertificateException - If a problem was encountered while initializing this trust manager.
      • checkClientTrusted

        public void checkClientTrusted​(java.security.cert.X509Certificate[] chain,
                                       java.lang.String authType)
                                throws java.security.cert.CertificateException
        Checks to determine whether the provided client certificate chain should be trusted.
        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​(java.security.cert.X509Certificate[] chain,
                                       java.lang.String authType)
                                throws java.security.cert.CertificateException
        Checks to determine whether the provided server certificate chain should be trusted.
        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

        public java.security.cert.X509Certificate[] getAcceptedIssuers()
        Retrieves the accepted issuer certificates for this trust manager.
        Specified by:
        getAcceptedIssuers in interface javax.net.ssl.X509TrustManager
        Returns:
        The accepted issuer certificates for this trust manager, or an empty set of accepted issuers if a problem was encountered while initializing this trust manager.