Package com.betfair.cougar.util

Examples of com.betfair.cougar.util.KeyStoreManagement


            client.setMaxConnectionsPerDestination(maxConnectionsPerDestination);
            client.setMaxRequestsQueuedPerDestination(maxRequestsQueuedPerDestination);

            //Configure SSL - if relevant
            if (transportSSLEnabled) {
                KeyStoreManagement keyStore = KeyStoreManagement.getKeyStoreManagement(httpsKeystoreType, httpsKeystore, httpsKeyPassword);
                if (jmxControl != null && keyStore != null) {
                    jmxControl.registerMBean("CoUGAR:name=AsyncHttpClientKeyStore,beanName="+beanName, keyStore);
                }
                KeyStoreManagement trustStore = KeyStoreManagement.getKeyStoreManagement(httpsTruststoreType, httpsTruststore, httpsTrustPassword);
                if (jmxControl != null) {
                    jmxControl.registerMBean("CoUGAR:name=AsyncHttpClientTrustStore,beanName="+beanName, trustStore);
                }
                if (trustStore == null) {
                    throw new IllegalStateException("This configuration ostensibly supports TLS, yet doesn't provide valid truststore configuration");
                }

                final SslContextFactory sslContextFactory = client.getSslContextFactory();

                com.betfair.cougar.netutil.SslContextFactory factory = new com.betfair.cougar.netutil.SslContextFactory();
                factory.setTrustManagerFactoryKeyStore(trustStore.getKeyStore());
                if (keyStore != null) {
                    factory.setKeyManagerFactoryKeyStore(keyStore.getKeyStore());
                    factory.setKeyManagerFactoryKeyStorePassword(httpsKeyPassword);
                }
                SSLContext context = factory.newInstance();
View Full Code Here


            client.setMaxConnectionsPerDestination(maxConnectionsPerDestination);
            client.setMaxRequestsQueuedPerDestination(maxRequestsQueuedPerDestination);

            //Configure SSL - if relevant
            if (transportSSLEnabled) {
                KeyStoreManagement keyStore = KeyStoreManagement.getKeyStoreManagement(httpsKeystoreType, httpsKeystore, httpsKeyPassword);
                if (jmxControl != null && keyStore != null) {
                    jmxControl.registerMBean("CoUGAR:name=AsyncHttpClientKeyStore,beanName="+beanName, keyStore);
                }
                KeyStoreManagement trustStore = KeyStoreManagement.getKeyStoreManagement(httpsTruststoreType, httpsTruststore, httpsTrustPassword);
                if (jmxControl != null) {
                    jmxControl.registerMBean("CoUGAR:name=AsyncHttpClientTrustStore,beanName="+beanName, trustStore);
                }
                if (trustStore == null) {
                    throw new IllegalStateException("This configuration ostensibly supports TLS, yet doesn't provide valid truststore configuration");
                }

                final SslContextFactory sslContextFactory = client.getSslContextFactory();

                com.betfair.cougar.netutil.SslContextFactory factory = new com.betfair.cougar.netutil.SslContextFactory();
                factory.setTrustManagerFactoryKeyStore(trustStore.getKeyStore());
                if (keyStore != null) {
                    factory.setKeyManagerFactoryKeyStore(keyStore.getKeyStore());
                    factory.setKeyManagerFactoryKeyStorePassword(httpsKeyPassword);
                }
                SSLContext context = factory.newInstance();
View Full Code Here

            HttpConnectionParams.setSoTimeout(params, connectTimeout);
        }

        //Configure SSL - if relevant
        if (transportSSLEnabled) {
            KeyStoreManagement keyStore = KeyStoreManagement.getKeyStoreManagement(httpsKeystoreType, httpsKeystore, httpsKeyPassword);
            if (jmxControl != null && keyStore != null) {
                jmxControl.registerMBean("CoUGAR:name=HttpClientKeyStore,beanName="+beanName, keyStore);
            }
            KeyStoreManagement trustStore = KeyStoreManagement.getKeyStoreManagement(httpsTruststoreType, httpsTruststore, httpsTrustPassword);
            if (jmxControl != null) {
                jmxControl.registerMBean("CoUGAR:name=HttpClientTrustStore,beanName="+beanName, trustStore);
            }
            SSLSocketFactory socketFactory = new SSLSocketFactory(keyStore != null ? keyStore.getKeyStore() : null, keyStore != null ? httpsKeyPassword : null, trustStore.getKeyStore());
            if (hostnameVerificationDisabled) {
                socketFactory.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
                LOGGER.warn("CRITICAL SECURITY CHECKS ARE DISABLED: server SSL certificate hostname " +
                        "verification is turned off.");
            }
View Full Code Here

            ByteBuffer.setUseDirectBuffers(isUseDirectBuffersInMina());

            SslContextFactory factory = new SslContextFactory();
            if (isServer) {
                if (supportsTls) {
                    KeyStoreManagement keystoreMgmt = getKeystoreCertificateChains();
                    if (keystoreMgmt == null) {
                        throw new IllegalStateException("This configuration ostensibly supports TLS, yet doesn't provide valid keystore configuration");
                    }
                    factory.setKeyManagerFactoryKeyStore(keystoreMgmt.getKeyStore());
                    factory.setKeyManagerFactoryKeyStorePassword(keystorePassword);
                    if (wantClientAuth) {
                        KeyStoreManagement truststoreMgmt = getTruststoreCertificateChains();
                        if (truststoreMgmt == null) {
                            throw new IllegalStateException("This configuration ostensibly supports client auth, yet doesn't provide valid truststore configuration");
                        }
                        factory.setTrustManagerFactoryKeyStore(truststoreMgmt.getKeyStore());
                    }
                }
            }
            else {
                if (supportsTls) {
                    KeyStoreManagement truststoreMgmt = getTruststoreCertificateChains();
                    if (truststoreMgmt == null) {
                        throw new IllegalStateException("This configuration ostensibly supports TLS, yet doesn't provide valid truststore configuration");
                    }
                    factory.setTrustManagerFactoryKeyStore(truststoreMgmt.getKeyStore());
                    if (wantClientAuth) {
                        KeyStoreManagement keystoreMgmt = getKeystoreCertificateChains();
                        if (keystoreMgmt == null) {
                            throw new IllegalStateException("This configuration ostensibly supports client auth, yet doesn't provide valid keystore configuration");
                        }
                        factory.setKeyManagerFactoryKeyStore(keystoreMgmt.getKeyStore());
                        factory.setKeyManagerFactoryKeyStorePassword(keystorePassword);
                    }
                }
            }
            SSLFilter sslFilter = null;
View Full Code Here

TOP

Related Classes of com.betfair.cougar.util.KeyStoreManagement

Copyright © 2018 www.massapicom. 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.