Examples of TrustSelfSignedStrategy


Examples of com.belladati.httpclientandroidlib.conn.ssl.TrustSelfSignedStrategy

   */
  private CloseableHttpClient buildClient(boolean trustSelfSigned) {
    try {
      // if required, define custom SSL context allowing self-signed certs
      SSLContext sslContext = !trustSelfSigned ? SSLContexts.createSystemDefault() : SSLContexts.custom()
        .loadTrustMaterial(null, new TrustSelfSignedStrategy()).build();

      // set timeouts for the HTTP client
      int globalTimeout = readFromProperty("bdTimeout", 10000);
      int connectTimeout = readFromProperty("bdConnectTimeout", globalTimeout);
      int connectionRequestTimeout = readFromProperty("bdConnectionRequestTimeout", globalTimeout);
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

    /**
     * Helper which returns HTTP client configured for https session
     */
    private HttpClient sslReadyHttpClient() throws GeneralSecurityException {
        DefaultHttpClient httpClient = new DefaultHttpClient(new PoolingClientConnectionManager());
        SSLSocketFactory sslSocketFactory = new SSLSocketFactory(new TrustSelfSignedStrategy(), null);
        Scheme scheme = new Scheme("https", server.getPort(), sslSocketFactory);
        httpClient.getConnectionManager().getSchemeRegistry().register(scheme);
        httpClient.getParams().setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 10000);
        return httpClient;
    }
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

   */
  private HttpClient buildClient(boolean trustSelfSigned) {
    try {
      // if required, define custom SSL context allowing self-signed certs
      SSLContext sslContext = !trustSelfSigned ? SSLContexts.createSystemDefault() : SSLContexts.custom()
        .loadTrustMaterial(null, new TrustSelfSignedStrategy()).build();

      // set timeouts for the HTTP client
      int globalTimeout = readFromProperty("bdTimeout", 10000);
      int connectTimeout = readFromProperty("bdConnectTimeout", globalTimeout);
      int connectionRequestTimeout = readFromProperty("bdConnectionRequestTimeout", globalTimeout);
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

            instream.close();
        }

        // Trust own CA and all self-signed certs
        SSLContext sslcontext = SSLContexts.custom()
                .loadTrustMaterial(trustStore, new TrustSelfSignedStrategy())
                .build();
        // Allow TLSv1 protocol only
        SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
                sslcontext,
                new String[] { "TLSv1" },
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

    }
  }

  private static DefaultHttpClient createClient() throws GeneralSecurityException {
    SchemeRegistry registry = new SchemeRegistry();
    SSLSocketFactory socketFactory = new SSLSocketFactory( new TrustSelfSignedStrategy(), SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER );
    registry.register( new Scheme( "https", 443, socketFactory ) );
    registry.register( new Scheme( "http", 80, new PlainSocketFactory() ) );
    PoolingClientConnectionManager mgr = new PoolingClientConnectionManager( registry );
    DefaultHttpClient client = new DefaultHttpClient( mgr, new DefaultHttpClient().getParams() );
    return client;
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

    }

    private static void installAllTrustingClientSsl() throws KeyManagementException,
        NoSuchAlgorithmException, KeyStoreException {
        SSLContextBuilder builder = new SSLContextBuilder();
        builder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
       
        // // Create a trust manager that does not validate certificate chains
        final TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {
            @Override
            public void checkClientTrusted(final X509Certificate[] chain, final String authType) {
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

    return new OauthClient(authorizationUrl, createRestTemplate(httpProxyConfiguration, trustSelfSignedCerts));
  }

  private void registerSslSocketFactory(HttpClient httpClient)  {
    try {
      SSLSocketFactory socketFactory = new SSLSocketFactory(new TrustSelfSignedStrategy(), STRICT_HOSTNAME_VERIFIER);
      httpClient.getConnectionManager().getSchemeRegistry().register(new Scheme("https", 443, socketFactory));
    } catch (GeneralSecurityException gse) {
      throw new RuntimeException("An error occurred setting up the SSLSocketFactory", gse);
    }
  }
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

   */
  private CloseableHttpClient buildClient(boolean trustSelfSigned) {
    try {
      // if required, define custom SSL context allowing self-signed certs
      SSLContext sslContext = !trustSelfSigned ? SSLContexts.createSystemDefault() : SSLContexts.custom()
        .loadTrustMaterial(null, new TrustSelfSignedStrategy()).build();

      // set timeouts for the HTTP client
      int globalTimeout = readFromProperty("bdTimeout", 10000);
      int connectTimeout = readFromProperty("bdConnectTimeout", globalTimeout);
      int connectionRequestTimeout = readFromProperty("bdConnectionRequestTimeout", globalTimeout);
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

        } finally {
            instream.close();
        }
        // Trust own CA and all self-signed certs
        SSLContext sslcontext = SSLContexts.custom()
                .loadTrustMaterial(trustStore, new TrustSelfSignedStrategy())
                .build();
        // Allow TLSv1 protocol only
        SSLIOSessionStrategy sslSessionStrategy = new SSLIOSessionStrategy(
                sslcontext,
                new String[] { "TLSv1" },
View Full Code Here

Examples of org.apache.http.conn.ssl.TrustSelfSignedStrategy

            return true;
          }
        };
        break;
      case LAX:
        trustStrategy = new TrustSelfSignedStrategy();
        break;
      default:
        trustStrategy = null;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.