Package javax.net.ssl

Examples of javax.net.ssl.SSLSocket


    }
   
    public Socket acceptSocket(ServerSocket socket)
        throws IOException
    {
        SSLSocket asock = null;
        try {
             asock = (SSLSocket)socket.accept();
             configureClientAuth(asock);
        } catch (SSLException e){
          throw new SocketException("SSL handshake error" + e.toString());
View Full Code Here


    /** Create a socket and connect */
    public static SSLSocket getSocket(EncryptionOptions options, InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException
    {
        SSLContext ctx = createSSLContext(options);
        SSLSocket socket = (SSLSocket) ctx.getSocketFactory().createSocket(address, port, localAddress, localPort);
        String[] suits = filterCipherSuites(socket.getSupportedCipherSuites(), options.cipher_suites);
        socket.setEnabledCipherSuites(suits);
        return socket;
    }
View Full Code Here

    /** Create a socket and connect, using any local address */
    public static SSLSocket getSocket(EncryptionOptions options, InetAddress address, int port) throws IOException
    {
        SSLContext ctx = createSSLContext(options);
        SSLSocket socket = (SSLSocket) ctx.getSocketFactory().createSocket(address, port);
        String[] suits = filterCipherSuites(socket.getSupportedCipherSuites(), options.cipher_suites);
        socket.setEnabledCipherSuites(suits);
        return socket;
    }
View Full Code Here

    /** Just create a socket */
    public static SSLSocket getSocket(EncryptionOptions options) throws IOException
    {
        SSLContext ctx = createSSLContext(options);
        SSLSocket socket = (SSLSocket) ctx.getSocketFactory().createSocket();
        String[] suits = filterCipherSuites(socket.getSupportedCipherSuites(), options.cipher_suites);
        socket.setEnabledCipherSuites(suits);
        return socket;
    }
View Full Code Here

        return enableCipherSuites(sslSocketFactory.createSocket(address, port, localAddress, localPort),
                                  new Object[]{address, port});
    }
   
    private Socket enableCipherSuites(Socket s, Object[] logParams) {
        SSLSocket socket = (SSLSocket)s;
       
        if ((socket != null) && (ciphers != null)) {
            socket.setEnabledCipherSuites(ciphers);
        }
        if ((socket != null) && (protocol != null)) {
            socket.setEnabledProtocols(new String[] {protocol});
        }
        if (socket == null) {
            LogUtils.log(LOG, Level.SEVERE,
                         "PROBLEM_CREATING_OUTBOUND_REQUEST_SOCKET",
                         logParams);
View Full Code Here

            // on its own based on internal configuration options.  FTPSClient does not lend itself
            // to subclassing for the purpose of overriding this behavior (private methods, fields, etc.).
            // As such, we create a socket (preconfigured by SSLContextParameters) from the context
            // we gave to FTPSClient and then setup FTPSClient to reuse the already configured configuration
            // from the socket for all future sockets it creates.  Not sexy and a little brittle, but it works.
            SSLSocket socket = (SSLSocket)context.getSocketFactory().createSocket();
            client.setEnabledCipherSuites(socket.getEnabledCipherSuites());
            client.setEnabledProtocols(socket.getEnabledProtocols());
            client.setNeedClientAuth(socket.getNeedClientAuth());
            client.setWantClientAuth(socket.getWantClientAuth());
            client.setEnabledSessionCreation(socket.getEnableSessionCreation());
        } else {
            client = new FTPSClient(getFtpsConfiguration().getSecurityProtocol(),
                                               getFtpsConfiguration().isImplicit());
           
            if (ftpClientKeyStoreParameters != null) {
View Full Code Here

    }

    public Socket acceptSocket(ServerSocket socket)
  throws IOException
    {
  SSLSocket asock = null;
  try {
       asock = (SSLSocket)socket.accept();
       asock.setNeedClientAuth(clientAuth);
  } catch (SSLException e){
    throw new SocketException("SSL handshake error" + e.toString());
  }
  return asock;
    }
View Full Code Here

            /*-----------------------*/
            /* Open socket to server */
            /*-----------------------*/
            try {
                if (uri.getScheme().equalsIgnoreCase("ejbds")) {
                    final SSLSocket sslSocket = (SSLSocket) SSLSocketFactory.getDefault().createSocket(uri.getHost(), uri.getPort());
                    // use an anonymous cipher suite so that a KeyManager or
                    // TrustManager is not needed
                    // NOTE: this assumes that the cipher suite is known. A check
                    // -should- be done first.
                    final String[] enabledCipherSuites = {"SSL_DH_anon_WITH_RC4_128_MD5"};
                    sslSocket.setEnabledCipherSuites(enabledCipherSuites);
                    socket = sslSocket;
                } else {
                    socket = new Socket(uri.getHost(), uri.getPort());
                }

View Full Code Here

    /** Create a socket and connect */
    public static SSLSocket getSocket(EncryptionOptions options, InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException
    {
        SSLContext ctx = createSSLContext(options);
        SSLSocket socket = (SSLSocket) ctx.getSocketFactory().createSocket(address, port, localAddress, localPort);
        String[] suits = filterCipherSuites(socket.getSupportedCipherSuites(), options.cipher_suites);
        socket.setEnabledCipherSuites(suits);
        return socket;
    }
View Full Code Here

    /** Create a socket and connect, using any local address */
    public static SSLSocket getSocket(EncryptionOptions options, InetAddress address, int port) throws IOException
    {
        SSLContext ctx = createSSLContext(options);
        SSLSocket socket = (SSLSocket) ctx.getSocketFactory().createSocket(address, port);
        String[] suits = filterCipherSuites(socket.getSupportedCipherSuites(), options.cipher_suites);
        socket.setEnabledCipherSuites(suits);
        return socket;
    }
View Full Code Here

TOP

Related Classes of javax.net.ssl.SSLSocket

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.