Class SSLUtil


  • public final class SSLUtil
    extends java.lang.Object
    KeyStoreUtil - Utilities for setting up SSL connections with specific client certificates
    • Method Detail

      • getHostCertNoCheck

        public static int getHostCertNoCheck()
      • getHostCertMinCheck

        public static int getHostCertMinCheck()
      • getHostCertNormalCheck

        public static int getHostCertNormalCheck()
      • isClientTrusted

        public static boolean isClientTrusted​(java.security.cert.X509Certificate[] chain,
                                              java.lang.String authType)
      • getKeyManagers

        public static javax.net.ssl.KeyManager[] getKeyManagers​(java.lang.String alias)
                                                         throws java.io.IOException,
                                                                java.security.GeneralSecurityException,
                                                                GenericConfigException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
        GenericConfigException
      • getKeyManagers

        public static javax.net.ssl.KeyManager[] getKeyManagers()
                                                         throws java.io.IOException,
                                                                java.security.GeneralSecurityException,
                                                                GenericConfigException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
        GenericConfigException
      • getTrustManagers

        public static javax.net.ssl.TrustManager[] getTrustManagers()
                                                             throws java.io.IOException,
                                                                    java.security.GeneralSecurityException,
                                                                    GenericConfigException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
        GenericConfigException
      • getTrustAnyManagers

        public static javax.net.ssl.TrustManager[] getTrustAnyManagers()
      • getKeyManagers

        public static javax.net.ssl.KeyManager[] getKeyManagers​(java.security.KeyStore ks,
                                                                java.lang.String password,
                                                                java.lang.String alias)
                                                         throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
      • getTrustManagers

        public static javax.net.ssl.TrustManager[] getTrustManagers​(java.security.KeyStore ks)
      • getSSLSocketFactory

        public static javax.net.ssl.SSLSocketFactory getSSLSocketFactory​(java.security.KeyStore ks,
                                                                         java.lang.String password,
                                                                         java.lang.String alias)
                                                                  throws java.io.IOException,
                                                                         java.security.GeneralSecurityException,
                                                                         GenericConfigException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
        GenericConfigException
      • getSSLContext

        public static javax.net.ssl.SSLContext getSSLContext​(java.security.KeyStore ks,
                                                             java.lang.String password,
                                                             java.lang.String alias,
                                                             boolean trustAny)
                                                      throws java.io.IOException,
                                                             java.security.GeneralSecurityException,
                                                             GenericConfigException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
        GenericConfigException
      • getSSLSocketFactory

        public static javax.net.ssl.SSLSocketFactory getSSLSocketFactory​(java.lang.String alias,
                                                                         boolean trustAny)
                                                                  throws java.io.IOException,
                                                                         java.security.GeneralSecurityException,
                                                                         GenericConfigException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
        GenericConfigException
      • getSSLContext

        public static javax.net.ssl.SSLContext getSSLContext​(java.lang.String alias,
                                                             boolean trustAny)
                                                      throws java.io.IOException,
                                                             java.security.GeneralSecurityException,
                                                             GenericConfigException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
        GenericConfigException
      • getSSLSocketFactory

        public static javax.net.ssl.SSLSocketFactory getSSLSocketFactory​(java.lang.String alias)
                                                                  throws java.io.IOException,
                                                                         java.security.GeneralSecurityException,
                                                                         GenericConfigException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
        GenericConfigException
      • getSSLSocketFactory

        public static javax.net.ssl.SSLSocketFactory getSSLSocketFactory()
                                                                  throws java.io.IOException,
                                                                         java.security.GeneralSecurityException,
                                                                         GenericConfigException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
        GenericConfigException
      • getSSLServerSocketFactory

        public static javax.net.ssl.SSLServerSocketFactory getSSLServerSocketFactory​(java.security.KeyStore ks,
                                                                                     java.lang.String password,
                                                                                     java.lang.String alias)
                                                                              throws java.io.IOException,
                                                                                     java.security.GeneralSecurityException,
                                                                                     GenericConfigException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
        GenericConfigException
      • getSSLServerSocketFactory

        public static javax.net.ssl.SSLServerSocketFactory getSSLServerSocketFactory​(java.lang.String alias)
                                                                              throws java.io.IOException,
                                                                                     java.security.GeneralSecurityException,
                                                                                     GenericConfigException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
        GenericConfigException
      • getHostnameVerifier

        public static javax.net.ssl.HostnameVerifier getHostnameVerifier​(int level)
      • loadJsseProperties

        public static void loadJsseProperties()
      • loadJsseProperties

        public static void loadJsseProperties​(boolean debug)