Package javax.net.ssl

Examples of javax.net.ssl.SSLServerSocket


       
        assertEquals("TLS", context.getProtocol());

        SSLEngine engine = context.createSSLEngine();
        SSLSocket socket = (SSLSocket) context.getSocketFactory().createSocket();
        SSLServerSocket serverSocket = (SSLServerSocket) context.getServerSocketFactory().createServerSocket();

        // default disable the SSL* protocols
        assertStartsWith(engine.getEnabledProtocols(), "TLS");
        assertStartsWith(socket.getEnabledProtocols(), "TLS");
        assertStartsWith(serverSocket.getEnabledProtocols(), "TLS");
    }
View Full Code Here


        assertEquals("SSLv3", context.getProtocol());

        SSLEngine engine = context.createSSLEngine();
        SSLSocket socket = (SSLSocket) context.getSocketFactory().createSocket();
        SSLServerSocket serverSocket = (SSLServerSocket) context.getServerSocketFactory().createServerSocket();

        // default disable the SSL* protocols
        assertStartsWith(engine.getEnabledProtocols(), "TLS");
        assertStartsWith(socket.getEnabledProtocols(), "TLS");
        assertStartsWith(serverSocket.getEnabledProtocols(), "TLS");

        // allow SSL* protocols by explicitly asking for them
        final SecureSocketProtocolsParameters protocols = new SecureSocketProtocolsParameters();
        protocols.getSecureSocketProtocol().add("SSLv3");
        scp.setSecureSocketProtocols(protocols);

        context = scp.createSSLContext();
        engine = context.createSSLEngine();
        socket = (SSLSocket) context.getSocketFactory().createSocket();
        serverSocket = (SSLServerSocket) context.getServerSocketFactory().createServerSocket();

        assertEquals(engine.getEnabledProtocols().length, 1);
        assertEquals(engine.getEnabledProtocols()[0], "SSLv3");
        assertEquals(socket.getEnabledProtocols().length, 1);
        assertEquals(socket.getEnabledProtocols()[0], "SSLv3");
        assertEquals(serverSocket.getEnabledProtocols().length, 1);
        assertEquals(serverSocket.getEnabledProtocols()[0], "SSLv3");
    }
View Full Code Here

     * Configures the given SSL server socket with the requested cipher suites,
     * protocol versions, and need for client authentication
     */
    private void initServerSocket(ServerSocket ssocket) {

        SSLServerSocket socket = (SSLServerSocket) ssocket;

        if (enabledCiphers != null) {
            socket.setEnabledCipherSuites(enabledCiphers);
        }

        String requestedProtocols = (String) attributes.get("protocols");
        setEnabledProtocols(socket, getEnabledProtocols(socket,
                                                         requestedProtocols));
View Full Code Here

    private static final Logger logger_ = LoggerFactory.getLogger(SSLFactory.class);

    public static SSLServerSocket getServerSocket(EncryptionOptions options, InetAddress address, int port) throws IOException
    {
        SSLContext ctx = createSSLContext(options);
        SSLServerSocket serverSocket = (SSLServerSocket)ctx.getServerSocketFactory().createServerSocket();
        serverSocket.setReuseAddress(true);
        String[] suits = filterCipherSuites(serverSocket.getSupportedCipherSuites(), options.cipher_suites);
        serverSocket.setEnabledCipherSuites(suits);
        serverSocket.bind(new InetSocketAddress(address, port), 100);
        return serverSocket;
    }
View Full Code Here

    }
    
    /** Set server socket properties ( accepted cipher suites, etc)
     */
    private void initServerSocket(ServerSocket ssocket) {
  SSLServerSocket socket=(SSLServerSocket)ssocket;

  // We enable all cipher suites when the socket is
  // connected - XXX make this configurable
  String cipherSuites[] = socket.getSupportedCipherSuites();
  socket.setEnabledCipherSuites(cipherSuites);

  // we don't know if client auth is needed -
  // after parsing the request we may re-handshake
  socket.setNeedClientAuth(clientAuth);
    }
View Full Code Here

        if (factory == null) {
            throw new IOException("Unable to obtain SSLServerSocketFactory for provided KeyStore");
        }

        SSLServerSocket socket = (SSLServerSocket) factory.createServerSocket(port);
        socket.setNeedClientAuth(clientAuth);
        return socket;
    }
View Full Code Here

            this.sssf = sssf;
            this.clientAuth = clientAuth;
        }
       
        public ServerSocket createServerSocket(int port) throws IOException {
            SSLServerSocket ss = (SSLServerSocket) sssf.createServerSocket(port);
            ss.setNeedClientAuth(clientAuth);
            return ss;
        }
View Full Code Here

    private static final Logger logger = LoggerFactory.getLogger(SSLFactory.class);

    public static SSLServerSocket getServerSocket(EncryptionOptions options, InetAddress address, int port) throws IOException
    {
        SSLContext ctx = createSSLContext(options);
        SSLServerSocket serverSocket = (SSLServerSocket)ctx.getServerSocketFactory().createServerSocket();
        serverSocket.setReuseAddress(true);
        String[] suits = filterCipherSuites(serverSocket.getSupportedCipherSuites(), options.cipher_suites);
        serverSocket.setEnabledCipherSuites(suits);
        serverSocket.bind(new InetSocketAddress(address, port), 100);
        return serverSocket;
    }
View Full Code Here

     * Configures the given SSL server socket with the requested cipher suites,
     * protocol versions, and need for client authentication
     */
    private void initServerSocket(ServerSocket ssocket) {

        SSLServerSocket socket = (SSLServerSocket) ssocket;

        if (enabledCiphers != null) {
            socket.setEnabledCipherSuites(enabledCiphers);
        }

        String requestedProtocols = (String) attributes.get("protocols");
        setEnabledProtocols(socket, getEnabledProtocols(socket,
                                                         requestedProtocols));
View Full Code Here

                return new ServerSocket(port, backlog);
            }
            else {
                // SSL is required.  Create one from the SSLServerFactory retrieved from the config.  This will
                // require additional QOS configuration after creation.
                SSLServerSocket serverSocket = (SSLServerSocket)getServerSocketFactory().createServerSocket(port, backlog);
                configureServerSocket(serverSocket);
                return serverSocket;
            }
        } catch (IOException ex) {
            log.error("Exception creating a server socket for port "  + port, ex);
View Full Code Here

TOP

Related Classes of javax.net.ssl.SSLServerSocket

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.