Examples of loadTrustMaterial()


Examples of org.apache.http.conn.ssl.SSLContextBuilder.loadTrustMaterial()

    }

    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.SSLContextBuilder.loadTrustMaterial()

    final HttpClientBuilder builder = HttpClientBuilder.create();
   
    // Allow self-signed SSL certificates:
    try {
      final SSLContextBuilder sslbuilder = new SSLContextBuilder();
      sslbuilder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
      final SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
          sslbuilder.build(),
          SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
     
      builder.setSSLSocketFactory(sslsf);
View Full Code Here

Examples of org.apache.http.conn.ssl.SSLContextBuilder.loadTrustMaterial()

    private static CloseableHttpClient createHttpsClient() {
        CloseableHttpClient chc = null;
        try {
            final SSLContextBuilder builder = new SSLContextBuilder();
            builder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
            chc = HttpClients.custom().setSSLSocketFactory(
                    new SSLConnectionSocketFactory(builder.build(),
                            SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER)).build();
        } catch (KeyManagementException ex) {
        } catch (NoSuchAlgorithmException ex) {
View Full Code Here

Examples of org.apache.http.conn.ssl.SSLContextBuilder.loadTrustMaterial()

    }

    @Test
    public final void givenHttpClientPost4_3_whenAcceptingAllCertificates_thenCanConsumeHttpsUriWithSelfSignedCertificate() throws IOException, GeneralSecurityException {
        final SSLContextBuilder builder = new SSLContextBuilder();
        builder.loadTrustMaterial(null, new TrustSelfSignedStrategy());
        final SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(builder.build());
        final CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(sslsf).build();

        // new
View Full Code Here

Examples of org.apache.http.conn.ssl.SSLContextBuilder.loadTrustMaterial()

        }

        if (acceptSelfSignedCerts) {
            try {
                SSLContextBuilder builder = new SSLContextBuilder();
                builder.loadTrustMaterial(null, new TrustStrategy() {
                    @Override
                    public boolean isTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
                        return true;
                    }
                });
View Full Code Here

Examples of org.apache.http.conn.ssl.SSLContextBuilder.loadTrustMaterial()

        if (isTrusted(method.getURI().getAuthority())) {
            // creating a special configuration that allows connections to non-trusted HTTPS hosts
            try {
                SSLContextBuilder sslContextBuilder = new SSLContextBuilder();
                sslContextBuilder.loadTrustMaterial(null, new TrustSelfSignedStrategy() {
                    @Override
                    public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
                        return true;
                    }
                });
View Full Code Here

Examples of org.apache.http.ssl.SSLContextBuilder.loadTrustMaterial()

        SocketFactory socketFactory = null;
        if ("https".equals(host.getSchemeName())) {
            final SSLContextBuilder sslContextBuilder = new SSLContextBuilder();
            sslContextBuilder.useProtocol("SSL");
            if (config.isDisableSSLVerification()) {
                sslContextBuilder.loadTrustMaterial(null, new TrustStrategy() {

                    @Override
                    public boolean isTrusted(
                            final X509Certificate[] chain, final String authType) throws CertificateException {
                        return true;
View Full Code Here

Examples of org.apache.http.ssl.SSLContextBuilder.loadTrustMaterial()

                        return true;
                    }

                });
            } else if (config.getTrustStorePath() != null) {
                sslContextBuilder.loadTrustMaterial(
                        new File(config.getTrustStorePath()),
                        config.getTrustStorePassword() != null ? config.getTrustStorePassword().toCharArray() : null);
            }
            if (config.getIdentityStorePath() != null) {
                sslContextBuilder.loadKeyMaterial(
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.