Examples of TLSClientParameters


Examples of org.apache.cxf.configuration.jsse.TLSClientParameters

                                   ? url.openConnection(proxy)
                                   : url.openConnection());
        if (HTTPS_URL_PROTOCOL_ID.equals(url.getProtocol())) {
           
            if (tlsClientParameters == null) {
                tlsClientParameters = new TLSClientParameters();
            }

            Exception ex = null;
            try {
                decorateWithTLS(tlsClientParameters, connection);
View Full Code Here

Examples of org.apache.cxf.configuration.jsse.TLSClientParameters

    }


    public synchronized SSLContext getSSLContext() throws GeneralSecurityException {
        TLSClientParameters tlsClientParameters = getTlsClientParameters();
        if (tlsClientParameters == null) {
            tlsClientParameters = new TLSClientParameters();
        }
        int hash = tlsClientParameters.hashCode();
        if (hash == lastTlsHash) {
            return sslContext;
        }
       
        String provider = tlsClientParameters.getJsseProvider();

        String protocol = tlsClientParameters.getSecureSocketProtocol() != null ? tlsClientParameters
            .getSecureSocketProtocol() : "TLS";

        SSLContext ctx = provider == null ? SSLContext.getInstance(protocol) : SSLContext
            .getInstance(protocol, provider);
        ctx.getClientSessionContext().setSessionTimeout(tlsClientParameters.getSslCacheTimeout());
        KeyManager[] keyManagers = tlsClientParameters.getKeyManagers();
        if (tlsClientParameters.getCertAlias() != null) {
            keyManagers = getKeyManagersWithCertAlias(tlsClientParameters, keyManagers);
        }
        ctx.init(keyManagers, tlsClientParameters.getTrustManagers(),
                 tlsClientParameters.getSecureRandom());

        sslContext = ctx;
        lastTlsHash = hash;
        sslState = null;
        return ctx;
View Full Code Here

Examples of org.apache.cxf.configuration.jsse.TLSClientParameters

        sslState = null;
        return ctx;
    }

    public void initializeSSLEngine(SSLContext sslcontext, SSLEngine sslengine) {
        TLSClientParameters tlsClientParameters = getTlsClientParameters();
        if (tlsClientParameters == null) {
            tlsClientParameters = new TLSClientParameters();
        }
        String[] cipherSuites = SSLUtils.getCiphersuites(tlsClientParameters.getCipherSuites(),
                                                         SSLUtils.getSupportedCipherSuites(sslcontext),
                                                         tlsClientParameters.getCipherSuitesFilter(), LOG, false);
        sslengine.setEnabledCipherSuites(cipherSuites);
    }
View Full Code Here

Examples of org.apache.cxf.configuration.jsse.TLSClientParameters

                entity.removeHeaders("Transfer-Encoding");
                entity.removeHeaders("Content-Type");
                entity.setEntity(null);
            }
            if (url.getScheme().equals("https") && tlsClientParameters == null) {
                tlsClientParameters = new TLSClientParameters();
            }
           
            BasicHttpContext ctx = new BasicHttpContext();
            if (AsyncHTTPConduit.this.proxyAuthorizationPolicy != null
                && AsyncHTTPConduit.this.proxyAuthorizationPolicy.getUserName() != null) {
View Full Code Here

Examples of org.apache.cxf.configuration.jsse.TLSClientParameters

          {
            Client client = ClientProxy.getClient(port);
            conduit = (HTTPConduit) client.getConduit();
          }

          TLSClientParameters tlsParams = new TLSClientParameters();
         
          /*Set whether or not JSEE should omit checking if the host name
          specified in the URL matches that of the Common Name (CN)
          on the server's certificate. Default is false; this attribute
          should not be set to true during production use*/
          //tlsParams.setDisableCNCheck(true);
         
          //CXF 2.1.3 will give IllegalExpection if you set protocol to SSL.
          tlsParams.setSecureSocketProtocol("SSLv3");
         
          //provide trust password
          KeyStore keyStore = KeyStore.getInstance("JKS");
          String trustpass = trustStorePassword;
         
          // provide your truststore file path
          File truststore = new File(trustStoreFilePath);
         
          keyStore.load(new FileInputStream(truststore), trustpass.toCharArray());
          TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
          trustFactory.init(keyStore);
          TrustManager[] tm = trustFactory.getTrustManagers();
          tlsParams.setTrustManagers(tm);

          // provide your client store file path
          File keystore = new File(keyStoreFilePath);
          keyStore.load(new FileInputStream(keystore), keyStorePassword.toCharArray());
          KeyManagerFactory keyFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
          keyFactory.init(keyStore, keyStorePassword.toCharArray());
          KeyManager[] km = keyFactory.getKeyManagers();
          tlsParams.setKeyManagers(km);

          conduit.setTlsClientParameters(tlsParams);
    }
    catch (Exception e)
    {
View Full Code Here

Examples of org.apache.cxf.configuration.jsse.TLSClientParameters

          {
            Client client = ClientProxy.getClient(port);
            conduit = (HTTPConduit) client.getConduit();
          }

          TLSClientParameters tlsParams = new TLSClientParameters();
         
          /*Set whether or not JSEE should omit checking if the host name
          specified in the URL matches that of the Common Name (CN)
          on the server's certificate. Default is false; this attribute
          should not be set to true during production use*/
          //tlsParams.setDisableCNCheck(true);
         
          //CXF 2.1.3 will give IllegalExpection if you set protocol to SSL.
          tlsParams.setSecureSocketProtocol("SSLv3");
         
          //provide trust password
          KeyStore keyStore = KeyStore.getInstance("JKS");
          String trustpass = trustStorePassword;
         
          // provide your truststore file path
          File truststore = new File(trustStoreFilePath);
         
          keyStore.load(new FileInputStream(truststore), trustpass.toCharArray());
          TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
          trustFactory.init(keyStore);
          TrustManager[] tm = trustFactory.getTrustManagers();
          tlsParams.setTrustManagers(tm);

          // provide your client store file path
          File keystore = new File(keyStoreFilePath);
          keyStore.load(new FileInputStream(keystore), keyStorePassword.toCharArray());
          KeyManagerFactory keyFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
          keyFactory.init(keyStore, keyStorePassword.toCharArray());
          KeyManager[] km = keyFactory.getKeyManagers();
          tlsParams.setKeyManagers(km);

          conduit.setTlsClientParameters(tlsParams);
    }
    catch (Exception e)
    {
View Full Code Here

Examples of org.apache.cxf.configuration.jsse.TLSClientParameters

            (HTTPConduit) client.getConduit();
       
        HTTPClientPolicy httpClientPolicy = http.getClient();
        assertEquals("the httpClientPolicy's autoRedirect should be true",
                     true, httpClientPolicy.isAutoRedirect());
        TLSClientParameters tlsParameters = http.getTlsClientParameters();
        assertNotNull("the http conduit's tlsParameters should not be null", tlsParameters);
       
       
        // If we set any name, but Edward, Mary, or George,
        // and a password of "password" we will get through
View Full Code Here

Examples of org.apache.cxf.configuration.jsse.TLSClientParameters

                                   ? url.openConnection(proxy)
                                   : url.openConnection());
        if (HTTPS_URL_PROTOCOL_ID.equals(url.getProtocol())) {
           
            if (tlsClientParameters == null) {
                tlsClientParameters = new TLSClientParameters();
            }

            Exception ex = null;
            try {
                decorateWithTLS(tlsClientParameters, connection);
View Full Code Here

Examples of org.apache.cxf.configuration.jsse.TLSClientParameters

            //ignore, just use info based on Tls
        }
        if (useHttps
            || configuredConduit.getTlsClientParameters() != null) {
           
            TLSClientParameters params = configuredConduit.getTlsClientParameters();
            if (params == null) {
                params = new TLSClientParameters(); //use defaults
            }
            fac = new HttpsURLConnectionFactory(params);
        } else {
            fac = new HttpURLConnectionFactoryImpl();
        }
View Full Code Here

Examples of org.apache.cxf.configuration.jsse.TLSClientParameters

            context = JAXBContext.newInstance(PackageUtils.getPackageName(TLSClientParametersType.class),
                    getClass().getClassLoader());
            Unmarshaller u = context.createUnmarshaller();
            JAXBElement<TLSClientParametersType> jaxb =
                u.unmarshal(n, TLSClientParametersType.class);
            TLSClientParameters params =
                new TLSClientParametersConfig(jaxb.getValue());
            bean.addPropertyValue("tlsClientParameters", params);
        } catch (Exception e) {
            throw new RuntimeException("Could not process configuration.", e);
        }
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.