Examples of SslContextFactory


Examples of com.betfair.cougar.netutil.SslContextFactory

    protected void configureProtocol(BaseIoServiceConfig config, boolean isServer) throws IOException {
        try {
            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;
            if (supportsTls) {
                sslFilter = new SSLFilter(factory.newInstance());
                sslFilter.setWantClientAuth(wantClientAuth);
                sslFilter.setNeedClientAuth(needClientAuth);
                sslFilter.setUseClientMode(!isServer);
                String[] cipherSuites = allowedCipherSuites == null || "".equals(allowedCipherSuites.trim()) ? null : allowedCipherSuites.split(",");
                if (cipherSuites != null) {
View Full Code Here

Examples of com.cloudhopper.smpp.ssl.SslContextFactory

  // add SSL handler
        if (server.getConfiguration().isUseSsl()) {
      SslConfiguration sslConfig = server.getConfiguration().getSslConfiguration();
      if (sslConfig == null) throw new IllegalStateException("sslConfiguration must be set");
      SslContextFactory factory = new SslContextFactory(sslConfig);
      SSLEngine sslEngine = factory.newSslEngine();
      sslEngine.setUseClientMode(false);
      channel.getPipeline().addLast(SmppChannelConstants.PIPELINE_SESSION_SSL_NAME, new SslHandler(sslEngine));
  }

        // add a new instance of a thread renamer
View Full Code Here

Examples of com.facebook.presto.jdbc.internal.jetty.util.ssl.SslContextFactory

            public void succeeded(Connection connection)
            {
                HttpDestination destination = (HttpDestination)context.get(HttpClientTransport.HTTP_DESTINATION_CONTEXT_KEY);
                if (HttpScheme.HTTPS.is(destination.getScheme()))
                {
                    SslContextFactory sslContextFactory = destination.getHttpClient().getSslContextFactory();
                    if (sslContextFactory != null)
                    {
                        tunnel(destination, connection);
                    }
                    else
View Full Code Here

Examples of com.hazelcast.nio.ssl.SSLContextFactory

        SSLSocketChannelWrapperFactory(SSLConfig sslConfig) {
            if (CipherHelper.isSymmetricEncryptionEnabled(ioService)) {
                throw new RuntimeException("SSL and SymmetricEncryption cannot be both enabled!");
            }
            SSLContextFactory sslContextFactoryObject = (SSLContextFactory) sslConfig.getFactoryImplementation();
            try {
                String factoryClassName = sslConfig.getFactoryClassName();
                if (sslContextFactoryObject == null && factoryClassName != null) {
                    sslContextFactoryObject = (SSLContextFactory) Class.forName(factoryClassName).newInstance();
                }
                if (sslContextFactoryObject == null) {
                    sslContextFactoryObject = new BasicSSLContextFactory();
                }
                sslContextFactoryObject.init(sslConfig.getProperties());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            sslContextFactory = sslContextFactoryObject;
        }
View Full Code Here

Examples of com.hazelcast.nio.ssl.SSLContextFactory

        SSLSocketChannelWrapperFactory(SSLConfig sslConfig) {
//            if (CipherHelper.isSymmetricEncryptionEnabled(ioService)) {
//                throw new RuntimeException("SSL and SymmetricEncryption cannot be both enabled!");
//            }
            SSLContextFactory sslContextFactoryObject = (SSLContextFactory) sslConfig.getFactoryImplementation();
            try {
                String factoryClassName = sslConfig.getFactoryClassName();
                if (sslContextFactoryObject == null && factoryClassName != null) {
                    sslContextFactoryObject = (SSLContextFactory) Class.forName(factoryClassName).newInstance();
                }
                if (sslContextFactoryObject == null) {
                    sslContextFactoryObject = new BasicSSLContextFactory();
                }
                sslContextFactoryObject.init(sslConfig.getProperties());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            sslContextFactory = sslContextFactoryObject;
        }
View Full Code Here

Examples of com.noelios.restlet.util.SslContextFactory

    /** Starts the Restlet. */
    @Override
    public void start() throws Exception {
        // Initialize the SSL context
        final SslContextFactory sslContextFactory = HttpsUtils
                .getSslContextFactory(this);
        SSLContext sslContext;
        /*
         * If an SslContextFactory has been set up, its settings take priority
         * over the other parameters (which are otherwise used to build and
         * initialise an SSLContext).
         */
        if (sslContextFactory == null) {
            final KeyStore keyStore = KeyStore.getInstance(getKeystoreType());
            final FileInputStream fis = getKeystorePath() == null ? null
                    : new FileInputStream(getKeystorePath());
            final char[] password = getKeystorePassword() == null ? null
                    : getKeystorePassword().toCharArray();
            keyStore.load(fis, password);
            if (fis != null) {
                fis.close();
            }

            final KeyManagerFactory keyManagerFactory = KeyManagerFactory
                    .getInstance(getCertAlgorithm());
            keyManagerFactory.init(keyStore, getKeyPassword().toCharArray());

            final TrustManagerFactory trustManagerFactory = TrustManagerFactory
                    .getInstance(getCertAlgorithm());
            trustManagerFactory.init(keyStore);

            sslContext = SSLContext.getInstance(getSslProtocol());
            sslContext.init(keyManagerFactory.getKeyManagers(),
                    trustManagerFactory.getTrustManagers(), null);
        } else {
            sslContext = sslContextFactory.createSslContext();
        }

        // Initialize the socket
        SSLServerSocket serverSocket = null;
        final String addr = getHelped().getAddress();
View Full Code Here

Examples of jp.go.aist.sot.client.net.SSLContextFactory

            PKCS12 pkcs12 = jp.go.aist.sot.client.security.KeyStore.convertKeyStoreToPKCS12(
                    ks, cn, passphrase.toCharArray());

            mgr.setPKCS12(pkcs12);

            SSLContextFactory factory = new SSLContextFactory(caks, uks,
                    passphrase.toCharArray());

            ctx = factory.getSSLContext();
            mgr.setSSLContext(ctx);

            passphrase = null;
            mgr.setSessionListener(this);
            mgr.setSignOnStatusListener(this);
View Full Code Here

Examples of org.apache.mina.filter.ssl.SslContextFactory

        final KeyStoreFactory trustStoreFactory = new KeyStoreFactory();
        trustStoreFactory.setDataFile(trustStore);
        trustStoreFactory.setPassword(truststorePassword);

        final SslContextFactory sslContextFactory = new SslContextFactory();
        final KeyStore ks = keyStoreFactory.newInstance();
        sslContextFactory.setKeyManagerFactoryKeyStore(ks);

        final KeyStore ts = trustStoreFactory.newInstance();
        sslContextFactory.setTrustManagerFactoryKeyStore(ts);
        sslContextFactory.setKeyManagerFactoryKeyStorePassword(keystorePassword);
        sslContext = sslContextFactory.newInstance();
        log.debug("SSL provider is: {}", sslContext.getProvider());
      } else {
        log.warn("Keystore or Truststore file does not exist");
      }
    } catch (Exception ex) {
View Full Code Here

Examples of org.apache.qpid.ssl.SSLContextFactory


            String keystorePath = serverConfig.getKeystorePath();
            String keystorePassword = serverConfig.getKeystorePassword();
            String certType = serverConfig.getCertType();
            SSLContextFactory sslFactory = null;

            if (!serverConfig.getSSLOnly())
            {

                for(int port : ports)
                {

                    NetworkDriver driver = new MINANetworkDriver();

                    Set<VERSION> supported = EnumSet.allOf(VERSION.class);

                    if(exclude_0_10.contains(port))
                    {
                        supported.remove(VERSION.v0_10);
                    }

                    if(exclude_0_9_1.contains(port))
                    {
                        supported.remove(VERSION.v0_9_1);
                    }
                    if(exclude_0_9.contains(port))
                    {
                        supported.remove(VERSION.v0_9);
                    }
                    if(exclude_0_8.contains(port))
                    {
                        supported.remove(VERSION.v0_8);
                    }

                    MultiVersionProtocolEngineFactory protocolEngineFactory =
                            new MultiVersionProtocolEngineFactory(hostName, supported);



                    driver.bind(port, new InetAddress[]{bindAddress}, protocolEngineFactory,
                                serverConfig.getNetworkConfiguration(), null);
                    ApplicationRegistry.getInstance().addAcceptor(new InetSocketAddress(bindAddress, port),
                                                                  new QpidAcceptor(driver,"TCP"));
                    CurrentActor.get().message(BrokerMessages.LISTENING("TCP", port));

                }

            }

            if (serverConfig.getEnableSSL())
            {
                sslFactory = new SSLContextFactory(keystorePath, keystorePassword, certType);
                NetworkDriver driver = new MINANetworkDriver();

                String sslPort = commandLine.getOptionValue("s");
                int port = 0;
                if (null != sslPort)
View Full Code Here

Examples of org.apache.qpid.ssl.SSLContextFactory

        return id.toString();
    }
   
    public static SSLContext createSSLContext(ConnectionSettings settings) throws Exception
    {
        SSLContextFactory sslContextFactory;
       
        if (settings.getCertAlias() == null)
        {
            sslContextFactory =
                new SSLContextFactory(settings.getTrustStorePath(),
                                      settings.getTrustStorePassword(),
                                      settings.getTrustStoreCertType(),
                                      settings.getKeyStorePath(),
                                      settings.getKeyStorePassword(),
                                      settings.getKeyStoreCertType());

        } else
        {
            sslContextFactory =
                new SSLContextFactory(settings.getTrustStorePath(),
                                      settings.getTrustStorePassword(),
                                      settings.getTrustStoreCertType(),
                    new QpidClientX509KeyManager(settings.getCertAlias(),
                                                     settings.getKeyStorePath(),
                                                     settings.getKeyStorePassword(),
                                                     settings.getKeyStoreCertType()));
           
            log.debug("Using custom key manager");
        }

        return sslContextFactory.buildServerContext();
       
    }
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.