Package javax.net.ssl

Examples of javax.net.ssl.SSLServerSocket


                return new ServerSocket(port, backlog, address);
            }
            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, address);
                configureServerSocket(serverSocket);
                return serverSocket;
            }
        } catch (IOException ex) {
            log.error("Exception creating a client socket to "  + address.getHostName() + ":" + port, ex);
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

    /* ------------------------------------------------------------ */
    protected ServerSocket newServerSocket(String host, int port,int backlog) throws IOException
    {
        SSLServerSocketFactory factory = null;
        SSLServerSocket socket = null;

        try
        {
            factory = createFactory();

            socket = (SSLServerSocket) (host==null?
                            factory.createServerSocket(port,backlog):
                            factory.createServerSocket(port,backlog,InetAddress.getByName(host)));

            if (_wantClientAuth)
                socket.setWantClientAuth(_wantClientAuth);
            if (_needClientAuth)
                socket.setNeedClientAuth(_needClientAuth);

            if (_excludeCipherSuites != null && _excludeCipherSuites.length >0)
            {
                List excludedCSList = Arrays.asList(_excludeCipherSuites);
                String[] enabledCipherSuites = socket.getEnabledCipherSuites();
              List enabledCSList = new ArrayList(Arrays.asList(enabledCipherSuites));
              Iterator exIter = excludedCSList.iterator();

                while (exIter.hasNext())
              {
                  String cipherName = (String)exIter.next();
                    if (enabledCSList.contains(cipherName))
                    {
                        enabledCSList.remove(cipherName);
                    }
              }
                enabledCipherSuites = (String[])enabledCSList.toArray(new String[enabledCSList.size()]);

                socket.setEnabledCipherSuites(enabledCipherSuites);
            }
           
        }
        catch (IOException e)
        {
View Full Code Here

  }

  private static TServerSocket createServer(SSLServerSocketFactory factory, int port, int timeout, boolean clientAuth,
                                    InetAddress ifAddress, TSSLTransportParameters params) throws TTransportException {
    try {
      SSLServerSocket serverSocket = (SSLServerSocket) factory.createServerSocket(port, 100, ifAddress);
      serverSocket.setSoTimeout(timeout);
      serverSocket.setNeedClientAuth(clientAuth);
      if (params != null && params.cipherSuites != null) {
        serverSocket.setEnabledCipherSuites(params.cipherSuites);
      }
      return new TServerSocket(serverSocket, timeout);
    } catch (Exception e) {
      throw new TTransportException("Could not bind to port " + port, e);
    }
View Full Code Here

         this.serverSocketFactory = serverSocketFactory;
      }

      public ServerSocket createServerSocket() throws IOException
      {
         SSLServerSocket ss = (SSLServerSocket) serverSocketFactory.createServerSocket();
         ss.setNeedClientAuth(true);
         return ss;
      }
View Full Code Here

         return ss;
      }

      public ServerSocket createServerSocket(int arg0) throws IOException
      {
         SSLServerSocket ss = (SSLServerSocket) serverSocketFactory.createServerSocket(arg0);
         ss.setNeedClientAuth(true);
         return ss;
      }
View Full Code Here

         return ss;
      }

      public ServerSocket createServerSocket(int arg0, int arg1) throws IOException
      {
         SSLServerSocket ss = (SSLServerSocket) serverSocketFactory.createServerSocket(arg0, arg1);
         ss.setNeedClientAuth(true);
         return ss;
      }
View Full Code Here

         return ss;
      }

      public ServerSocket createServerSocket(int arg0, int arg1, InetAddress arg2) throws IOException
      {
         SSLServerSocket ss = (SSLServerSocket) serverSocketFactory.createServerSocket(arg0, arg1, arg2);
         ss.setNeedClientAuth(true);
         return ss;
       
      }
View Full Code Here

    @Override
    public ServerSocket createServerSocket(int port, int backlog, InetAddress inetAddress) throws IOException {
        this.initSSLContext();
        SSLServerSocketFactory serverSocketFactory = this.sslContext.getServerSocketFactory();
        SSLServerSocket serverSocket = (SSLServerSocket) serverSocketFactory.createServerSocket(port, backlog, inetAddress);
        if (this.jsseSecurityDomain.getProtocols() != null)
            serverSocket.setEnabledProtocols(this.jsseSecurityDomain.getProtocols());
        if (this.jsseSecurityDomain.getCipherSuites() != null)
            serverSocket.setEnabledCipherSuites(this.jsseSecurityDomain.getCipherSuites());

        if (this.jsseSecurityDomain.isClientAuth() || this.require_mutual_auth)
            serverSocket.setNeedClientAuth(true);
        else
            serverSocket.setWantClientAuth(this.request_mutual_auth);

        return serverSocket;
    }
View Full Code Here

         this.serverSocketFactory = serverSocketFactory;
      }

      public ServerSocket createServerSocket() throws IOException
      {
         SSLServerSocket ss = (SSLServerSocket) serverSocketFactory.createServerSocket();
         ss.setNeedClientAuth(true);
         return ss;
      }
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.