当前位置: 首页>>代码示例>>Java>>正文


Java SSLServerSocket.setEnabledCipherSuites方法代码示例

本文整理汇总了Java中javax.net.ssl.SSLServerSocket.setEnabledCipherSuites方法的典型用法代码示例。如果您正苦于以下问题:Java SSLServerSocket.setEnabledCipherSuites方法的具体用法?Java SSLServerSocket.setEnabledCipherSuites怎么用?Java SSLServerSocket.setEnabledCipherSuites使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.net.ssl.SSLServerSocket的用法示例。


在下文中一共展示了SSLServerSocket.setEnabledCipherSuites方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initServerSocket

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
/**
 * 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));

    // we don't know if client auth is needed -
    // after parsing the request we may re-handshake
    configureClientAuth(socket);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:21,代码来源:JSSESocketFactory.java

示例2: finishServerSocket

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
/**
 * Configure the SSLServerSocket based on this SocketCreator's settings.
 */
private void finishServerSocket(SSLServerSocket serverSocket) throws IOException {
  serverSocket.setUseClientMode(false);
  if (this.sslConfig.isRequireAuth()) {
    // serverSocket.setWantClientAuth( true );
    serverSocket.setNeedClientAuth(true);
  }
  serverSocket.setEnableSessionCreation(true);

  // restrict protocols
  String[] protocols = this.sslConfig.getProtocolsAsStringArray();
  if (!"any".equalsIgnoreCase(protocols[0])) {
    serverSocket.setEnabledProtocols(protocols);
  }
  // restrict ciphers
  String[] ciphers = this.sslConfig.getCiphersAsStringArray();
  if (!"any".equalsIgnoreCase(ciphers[0])) {
    serverSocket.setEnabledCipherSuites(ciphers);
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:23,代码来源:SocketCreator.java

示例3: configureServerSocket

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
/**
 * Set the server socket configuration to our required
 * QOS values.
 *
 * A small experiment shows that setting either (want, need) parameter to either true or false sets the
 * other parameter to false.
 *
 * @param serverSocket
 *               The newly created SSLServerSocket.
 *
 * @throws IOException if server socket can't be configured
 */
private void configureServerSocket(SSLServerSocket serverSocket) throws IOException {
    // set the authentication value and cipher suite info.
    serverSocket.setEnabledCipherSuites(cipherSuites);
    if (clientAuthRequired) {
        serverSocket.setNeedClientAuth(true);
    } else if (clientAuthSupported) {
        serverSocket.setWantClientAuth(true);
    } else {
        serverSocket.setNeedClientAuth(false); //could set want with the same effect
    }
    serverSocket.setSoTimeout(SOCKET_TIMEOUT_MS);

    if (log.isDebugEnabled()) {
        log.debug("Created SSL server socket on port " + serverSocket.getLocalPort());
        log.debug("    client authentication " + (clientAuthSupported ? "SUPPORTED" : "UNSUPPORTED"));
        log.debug("    client authentication " + (clientAuthRequired ? "REQUIRED" : "OPTIONAL"));
        log.debug("    cipher suites:");

        for (int i = 0; i < cipherSuites.length; i++) {
            log.debug("    " + cipherSuites[i]);
        }
    }
}
 
开发者ID:RuiChen08,项目名称:dacapobench,代码行数:36,代码来源:SocketFactory.java

示例4: JSSEServer

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
JSSEServer(CipherTestUtils cipherTest, int serverPort,
        String protocol, String cipherSuite) throws Exception {
    super(cipherTest);
    this.serverPort = serverPort;
    SSLContext serverContext = SSLContext.getInstance("TLS");
    serverContext.init(new KeyManager[]{cipherTest.getServerKeyManager()},
            new TrustManager[]{cipherTest.getServerTrustManager()},
            CipherTestUtils.secureRandom);
    SSLServerSocketFactory factory =
            (SSLServerSocketFactory)serverContext.getServerSocketFactory();
    serverSocket =
            (SSLServerSocket) factory.createServerSocket(serverPort);
    serverSocket.setEnabledProtocols(protocol.split(","));
    serverSocket.setEnabledCipherSuites(cipherSuite.split(","));

    CipherTestUtils.printInfo(serverSocket);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:JSSEServer.java

示例5: initSecure

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
final ServerSocket initSecure(int port) throws Exception {
    ServerSocketFactory fac;
    if (sslContext != null) {
        fac = sslContext.getServerSocketFactory();
    } else {
        fac = SSLServerSocketFactory.getDefault();
    }
    SSLServerSocket se = (SSLServerSocket) fac.createServerSocket(port);
    SSLParameters sslp = se.getSSLParameters();
    sslp.setApplicationProtocols(new String[]{"h2"});
    se.setSSLParameters(sslp);
    se.setEnabledCipherSuites(se.getSupportedCipherSuites());
    se.setEnabledProtocols(se.getSupportedProtocols());
    // other initialisation here
    return se;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:Http2TestServer.java

示例6: JSSEServer

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
JSSEServer(CipherTestUtils cipherTest, int serverPort,
        String protocol, String cipherSuite) throws Exception {
    super(cipherTest);
    SSLContext serverContext = SSLContext.getInstance("TLS");
    serverContext.init(new KeyManager[]{cipherTest.getServerKeyManager()},
            new TrustManager[]{cipherTest.getServerTrustManager()},
            CipherTestUtils.secureRandom);
    SSLServerSocketFactory factory =
            (SSLServerSocketFactory)serverContext.getServerSocketFactory();
    serverSocket =
            (SSLServerSocket) factory.createServerSocket(serverPort);
    serverSocket.setEnabledProtocols(protocol.split(","));
    serverSocket.setEnabledCipherSuites(cipherSuite.split(","));

    CipherTestUtils.printInfo(serverSocket);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:JSSEServer.java

示例7: newSslServerSocket

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
public SSLServerSocket newSslServerSocket(String host,int port,int backlog) throws IOException {
    SSLServerSocketFactory factory = sslContext.getServerSocketFactory();

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

    if (sslConfig.getWantClientAuth())
        socket.setWantClientAuth(sslConfig.getWantClientAuth());
    if (sslConfig.getNeedClientAuth())
        socket.setNeedClientAuth(sslConfig.getNeedClientAuth());

    socket.setEnabledCipherSuites(selectCipherSuites(socket.getEnabledCipherSuites(),
			 socket.getSupportedCipherSuites()));
    socket.setEnabledProtocols(selectProtocols(socket.getEnabledProtocols(),socket.getSupportedProtocols()));
	
    return socket;
}
 
开发者ID:nkasvosve,项目名称:beyondj,代码行数:20,代码来源:SslContextFactory.java

示例8: createServer

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
private static GfxdTSSLServerSocket createServer(
    SSLServerSocketFactory factory, InetSocketAddress bindAddress,
    SocketParameters params) throws TTransportException {
  try {
    SSLServerSocket serverSocket = (SSLServerSocket)factory
        .createServerSocket(bindAddress.getPort(), 100,
            bindAddress.getAddress());
    if (params != null) {
      if (params.getSSLEnabledProtocols() != null) {
        serverSocket.setEnabledProtocols(params.getSSLEnabledProtocols());
      }
      if (params.getSSLCipherSuites() != null) {
        serverSocket.setEnabledCipherSuites(params.getSSLCipherSuites());
      }
      serverSocket.setNeedClientAuth(params.getSSLClientAuth());
    }
    return new GfxdTSSLServerSocket(serverSocket, bindAddress, params);
  } catch (Exception e) {
    throw new TTransportException(TTransportException.NOT_OPEN,
        "Could not bind to host:port " + bindAddress.toString(), e);
  }
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:23,代码来源:GfxdTSSLServerSocketFactory.java

示例9: initSslServerSocket

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
/**
 * Initializes the SSL server socket. Configures the certificate request
 * (need or want) and the enabled cipher suites.
 * 
 * @param sslServerSocket
 *            The server socket to initialize.
 * @return The initialized server socket.
 */
protected SSLServerSocket initSslServerSocket(
        SSLServerSocket sslServerSocket) {
    if (getContextFactory().isNeedClientAuthentication()) {
        sslServerSocket.setNeedClientAuth(true);
    } else if (getContextFactory().isWantClientAuthentication()) {
        sslServerSocket.setWantClientAuth(true);
    }

    if ((getContextFactory().getEnabledCipherSuites() != null)
            || (getContextFactory().getDisabledCipherSuites() != null)) {
        sslServerSocket.setEnabledCipherSuites(getContextFactory()
                .getSelectedCipherSuites(
                        sslServerSocket.getSupportedCipherSuites()));
    }

    if ((getContextFactory().getEnabledProtocols() != null)
            || (getContextFactory().getDisabledProtocols() != null)) {
        sslServerSocket.setEnabledProtocols(getContextFactory()
                .getSelectedSslProtocols(
                        sslServerSocket.getSupportedProtocols()));
    }

    return sslServerSocket;
}
 
开发者ID:restlet,项目名称:restlet-framework,代码行数:33,代码来源:WrapperSslServerSocketFactory.java

示例10: BlockingServletEngine

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
BlockingServletEngine(FilterChain dispatcher, ServletEngineConfiguration config)
    throws InterruptedException, IOException {
  this.config = config;
  if (config.isSecure()) {
    SSLServerSocketFactory factory = (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
    SSLServerSocket sslServerSocket = (SSLServerSocket)factory.createServerSocket(config.getPort());
    sslServerSocket.setEnabledCipherSuites(config.getEnabledCipherSuites());
    serverSocket = sslServerSocket;
  } else {
    serverSocket = new ServerSocket(config.getPort());
  }
  int nthreads = config.getMaxThreads();
  queue = new DispatchQueueImpl(nthreads);
  handler = new HttpRequestHandlerAdapter(dispatcher);
  socketHandler = new HttpSocketHandler(handler);
  for (int i = 0; i < nthreads; ++i) {
    queue.addRunnable(new AcceptSocketAndHandleRequest(socketHandler, serverSocket));
  }
}
 
开发者ID:bboypscmylife,项目名称:opengse,代码行数:20,代码来源:BlockingServletEngine.java

示例11: createSocket

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
/**
 * Create a ServerSocket. If the 'useSSL' has been specified as true, it
 * will create a SSLServerSocket without certification ("ANON" Cypher Suites).
 * 
 * @param port Port of the ServerSocket
 * @return ServerSocket / SSLServerSocket
 * @throws IOException 
 */
private ServerSocket createSocket(int port) throws IOException
{
    if(useSSL)
    {
        if(factory == null)
        {
            factory = (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
            cipherSuites = Stream.of(factory.getSupportedCipherSuites())
                    .filter(c -> c.toLowerCase().contains("anon"))
                    .toArray(String[]::new);
        }
        SSLServerSocket socket = (SSLServerSocket)factory.createServerSocket(port);
        socket.setEnabledCipherSuites(cipherSuites);
        return socket;
    }
    else
        return new ServerSocket(port);
}
 
开发者ID:AstartesGuardian,项目名称:WebDAV-Server,代码行数:27,代码来源:HTTPServer.java

示例12: newSslServerSocket

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
public SSLServerSocket newSslServerSocket(String host,int port,int backlog) throws IOException
{
    SSLServerSocketFactory factory = _context.getServerSocketFactory();

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

    if (getWantClientAuth())
        socket.setWantClientAuth(getWantClientAuth());
    if (getNeedClientAuth())
        socket.setNeedClientAuth(getNeedClientAuth());

    socket.setEnabledCipherSuites(selectCipherSuites(
                                        socket.getEnabledCipherSuites(),
                                        socket.getSupportedCipherSuites()));
    socket.setEnabledProtocols(selectProtocols(socket.getEnabledProtocols(),socket.getSupportedProtocols()));

    return socket;
}
 
开发者ID:itead,项目名称:IoTgo_Android_App,代码行数:22,代码来源:SslContextFactory.java

示例13: open

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
private void open() {
  try {
    if (debugSettings.isUseSsslEncryption()) {
      SSLServerSocket sslServerSocket =
          (SSLServerSocket)
              SSLServerSocketFactory.getDefault()
                  .createServerSocket(debugSettings.getDebugPort());
      sslServerSocket.setEnabledCipherSuites(sslServerSocket.getSupportedCipherSuites());
      this.debugSocket = sslServerSocket;
    } else {
      this.debugSocket = new ServerSocket(debugSettings.getDebugPort());
    }
  } catch (Exception e) {
    ZendDebugger.LOG.error(e.getMessage(), e);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:ZendDbgConnection.java

示例14: createServerSocket

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
@Override
public ServerSocket createServerSocket(int port) throws IOException  {
    SSLServerSocket sslServerSocket =
            (SSLServerSocket) sslServerSocketFactory.createServerSocket(port, 0, bindAddress);
    if (getEnabledCipherSuites() != null) {
        sslServerSocket.setEnabledCipherSuites(getEnabledCipherSuites());
    }
    if (getEnabledProtocols() == null) {
        sslServerSocket.setEnabledProtocols(defaultProtocols);
    } else {
        sslServerSocket.setEnabledProtocols(getEnabledProtocols());
    }
    sslServerSocket.setNeedClientAuth(getNeedClientAuth());
    return sslServerSocket;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:16,代码来源:JmxRemoteLifecycleListener.java

示例15: initServerSocket

import javax.net.ssl.SSLServerSocket; //导入方法依赖的package包/类
/**
 * 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;

    socket.setEnabledCipherSuites(enabledCiphers);
    socket.setEnabledProtocols(enabledProtocols);
    
    // we don't know if client auth is needed -
    // after parsing the request we may re-handshake
    configureClientAuth(socket);
    configureUseServerCipherSuitesOrder(socket);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:17,代码来源:JSSESocketFactory.java


注:本文中的javax.net.ssl.SSLServerSocket.setEnabledCipherSuites方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。