类org.apache.http.conn.ssl.SSLInitializationException源码实例Demo

下面列出了怎么用org.apache.http.conn.ssl.SSLInitializationException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: snowflake-jdbc   文件: SnowflakeS3Client.java
private static SSLConnectionSocketFactory getSSLConnectionSocketFactory()
{
  if (s3ConnectionSocketFactory == null)
  {
    synchronized (SnowflakeS3Client.class)
    {
      if (s3ConnectionSocketFactory == null)
      {
        try
        {
          // trust manager is set to null, which will use default ones
          // instead of SFTrustManager (which enables ocsp checking)
          s3ConnectionSocketFactory = new SFSSLConnectionSocketFactory(null,
                                                                       HttpUtil.isSocksProxyDisabled());
        }
        catch (KeyManagementException | NoSuchAlgorithmException e)
        {
          throw new SSLInitializationException(e.getMessage(), e);
        }
      }
    }
  }

  return s3ConnectionSocketFactory;
}
 
源代码2 项目: aws-sdk-java-v2   文件: ApacheHttpClient.java
private SSLContext getSslContext(AttributeMap standardOptions) {
    Validate.isTrue(standardOptions.get(SdkHttpConfigurationOption.TLS_TRUST_MANAGERS_PROVIDER) == null ||
                    !standardOptions.get(SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES),
                    "A TlsTrustManagerProvider can't be provided if TrustAllCertificates is also set");

    TrustManager[] trustManagers = null;
    if (standardOptions.get(SdkHttpConfigurationOption.TLS_TRUST_MANAGERS_PROVIDER) != null) {
        trustManagers = standardOptions.get(SdkHttpConfigurationOption.TLS_TRUST_MANAGERS_PROVIDER).trustManagers();
    }

    if (standardOptions.get(SdkHttpConfigurationOption.TRUST_ALL_CERTIFICATES)) {
        log.warn(() -> "SSL Certificate verification is disabled. This is not a safe setting and should only be "
                       + "used for testing.");
        trustManagers = trustAllTrustManager();
    }

    TlsKeyManagersProvider provider = standardOptions.get(SdkHttpConfigurationOption.TLS_KEY_MANAGERS_PROVIDER);
    KeyManager[] keyManagers = provider.keyManagers();

    try {
        SSLContext sslcontext = SSLContext.getInstance("TLS");
        // http://download.java.net/jdk9/docs/technotes/guides/security/jsse/JSSERefGuide.html
        sslcontext.init(keyManagers, trustManagers, null);
        return sslcontext;
    } catch (final NoSuchAlgorithmException | KeyManagementException ex) {
        throw new SSLInitializationException(ex.getMessage(), ex);
    }
}
 
 类所在包
 类方法
 同包方法