Package javax.net.ssl

Examples of javax.net.ssl.SSLServerSocketFactory


  private boolean _allowRenegotiate = false;

  @Override
  public ServerSocket newServerSocket() throws IOException
  {
    SSLServerSocketFactory factory = null;
    SSLServerSocket socket = null;

    try
    {
      factory = createFactory();

      socket = (SSLServerSocket) (getHost() == null ? factory.createServerSocket(getPort(),
          getBacklogSize()) : factory.createServerSocket(getPort(), getBacklogSize(), InetAddress
          .getByName(getHost())));

      if (_wantClientAuth)
        socket.setWantClientAuth(_wantClientAuth);
      if (_needClientAuth)
View Full Code Here


   * Creates the SSL ServerSocket.
   */
  public QServerSocket create(InetAddress host, int port)
    throws IOException, GeneralSecurityException
  {
    SSLServerSocketFactory factory = null;
   
    if (_keyStore != null) {
      SSLContext sslContext = SSLContext.getInstance(_sslContext);

      KeyManagerFactory kmf
        = KeyManagerFactory.getInstance(_keyManagerFactory);
   
      kmf.init(_keyStore, _password.toCharArray());
     
      sslContext.init(kmf.getKeyManagers(), null, null);

      /*
      if (_cipherSuites != null)
        sslContext.createSSLEngine().setEnabledCipherSuites(_cipherSuites);

      if (_protocols != null)
        sslContext.createSSLEngine().setEnabledProtocols(_protocols);
      */

      factory = sslContext.getServerSocketFactory();
    }
    else {
      factory = createAnonymousFactory(host, port);
    }

    ServerSocket serverSocket;

    int listen = 100;

    if (host == null)
      serverSocket = factory.createServerSocket(port, listen);
    else
      serverSocket = factory.createServerSocket(port, listen, host);

    SSLServerSocket sslServerSocket = (SSLServerSocket) serverSocket;
   
    if (_cipherSuites != null) {
      sslServerSocket.setEnabledCipherSuites(_cipherSuites);
View Full Code Here

     
    sslContext.init(cert.getKeyManagers(), null, null);

    // SSLEngine engine = sslContext.createSSLEngine();

    SSLServerSocketFactory factory = sslContext.getServerSocketFactory();

    return factory;
  }
View Full Code Here

        ServerSocketFactory.getDefault();
      return sf.createServerSocket(portNumber
                     ,0,
                     hostAddress);
    case SSL_BASIC:
      SSLServerSocketFactory ssf =
        (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
      return (SSLServerSocket)ssf.createServerSocket(portNumber,
                               0,
                               hostAddress);
    case SSL_PEER_AUTHENTICATION:
      SSLServerSocketFactory ssf2 =
        (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
      SSLServerSocket sss2=
        (SSLServerSocket)ssf2.createServerSocket(portNumber,
                             0,
                             hostAddress);
      sss2.setNeedClientAuth(true);
      return sss2;
    }
View Full Code Here

            throw new IllegalStateException
                (this.toString() + " already running");

        ServerSocket ssock;
        if (sslcontext != null) {
            SSLServerSocketFactory sf = sslcontext.getServerSocketFactory();
            ssock = sf.createServerSocket();
        } else {
            ssock = new ServerSocket();
        }
       
        ssock.setReuseAddress(true); // probably pointless for port '0'
View Full Code Here

            {
                _serverSocket = new ServerSocket();
            }
            else
            {
                SSLServerSocketFactory socketFactory = _sslContext.getServerSocketFactory();
                _serverSocket = socketFactory.createServerSocket();

                if(config.needClientAuth())
                {
                    ((SSLServerSocket)_serverSocket).setNeedClientAuth(true);
                }
View Full Code Here

        ServerSocketFactory.getDefault();
      return sf.createServerSocket(portNumber
                     ,0,
                     hostAddress);
    case SSL_BASIC:
      SSLServerSocketFactory ssf =
        (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
      return (SSLServerSocket)ssf.createServerSocket(portNumber,
                               0,
                               hostAddress);
    case SSL_PEER_AUTHENTICATION:
      SSLServerSocketFactory ssf2 =
        (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
      SSLServerSocket sss2=
        (SSLServerSocket)ssf2.createServerSocket(portNumber,
                             0,
                             hostAddress);
      sss2.setNeedClientAuth(true);
      return sss2;
    }
View Full Code Here

            // Ignore
        }
    }

    private void setupSsl() throws GeneralSecurityException {
        SSLServerSocketFactory sslServerSocketFactory = keystoreManager.createSSLServerFactory(null, secureProtocol, algorithm, keyStore, keyAlias, trustStore, keyStoreAvailabilityTimeout);
        RMIServerSocketFactory rmiServerSocketFactory = new KarafSslRMIServerSocketFactory(sslServerSocketFactory, this.isClientAuth());
        RMIClientSocketFactory rmiClientSocketFactory = new SslRMIClientSocketFactory();
        environment.put(RMIConnectorServer.RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE, rmiServerSocketFactory);
        environment.put(RMIConnectorServer.RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE, rmiClientSocketFactory);
        // TODO secure RMI connector as well ?
View Full Code Here

            return this.context.getServerSessionContext();
        }

        @Override
        protected SSLServerSocketFactory engineGetServerSocketFactory() {
            SSLServerSocketFactory factory = this.context.getServerSocketFactory();
            LOG.debug("SSLServerSocketFactoryEngine [{}] created from SSLContext [{}].", factory, context);
            return this.configureSSLServerSocketFactory(factory);
        }
View Full Code Here

         * @param factory the factory to configure
         * @return {@code factory} or a decorated instance there of
         */
        protected SSLServerSocketFactory configureSSLServerSocketFactory(
                SSLServerSocketFactory factory) {
            SSLServerSocketFactory workingFactory = factory;
           
            for (Configurer<SSLServerSocketFactory> configurer : this.sslServerSocketFactoryConfigurers) {
                workingFactory = configurer.configure(workingFactory);
            }
           
View Full Code Here

TOP

Related Classes of javax.net.ssl.SSLServerSocketFactory

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.