javax.net.ssl.SSLServerSocket.getSupportedCipherSuites()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(162)

本文整理了Java中javax.net.ssl.SSLServerSocket.getSupportedCipherSuites()方法的一些代码示例,展示了SSLServerSocket.getSupportedCipherSuites()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SSLServerSocket.getSupportedCipherSuites()方法的具体详情如下:
包路径:javax.net.ssl.SSLServerSocket
类名称:SSLServerSocket
方法名:getSupportedCipherSuites

SSLServerSocket.getSupportedCipherSuites介绍

[英]Returns the names of the supported cipher suites.
[中]返回支持的密码套件的名称。

代码示例

代码示例来源:origin: wildfly/wildfly

public String[] getSupportedCipherSuites() {
  return delegate.getSupportedCipherSuites();
}

代码示例来源:origin: wildfly/wildfly

public void setSSLParameters(final SSLContext sslContext, final SSLServerSocket sslServerSocket, final SSLParameters parameters) {
  sslServerSocket.setSSLParameters(redefine(parameters, sslServerSocket.getSupportedCipherSuites(), sslServerSocket.getSupportedProtocols()));
}

代码示例来源:origin: wildfly/wildfly

public void configure(final SSLContext context, final SSLServerSocket sslServerSocket) {
  sslServerSocket.setUseClientMode(clientMode);
  final SSLParameters sslParameters = sslServerSocket.getSSLParameters();
  configure(sslParameters, sslServerSocket.getSupportedProtocols(), sslServerSocket.getSupportedCipherSuites());
  sslServerSocket.setSSLParameters(sslParameters);
}

代码示例来源:origin: com.h2database/h2

String[] list = enableAnonymous(
    secureSocket.getEnabledCipherSuites(),
    secureSocket.getSupportedCipherSuites());
secureSocket.setEnabledCipherSuites(list);

代码示例来源:origin: camunda/camunda-bpm-platform

public String[] getSupportedCipherSuites() {
 return delegate.getSupportedCipherSuites();
}

代码示例来源:origin: apache/servicecomb-java-chassis

public static SSLServerSocket createSSLServerSocket(SSLOption option,
  SSLCustom custom) {
 try {
  SSLContext context = createSSLContext(option, custom);
  SSLServerSocketFactory factory = context.getServerSocketFactory();
  SSLServerSocket socket =
    (SSLServerSocket) factory.createServerSocket();
  socket.setEnabledProtocols(option.getProtocols().split(","));
  String[] supported = socket.getSupportedCipherSuites();
  String[] eanbled = option.getCiphers().split(",");
  socket.setEnabledCipherSuites(getEnabledCiphers(supported, eanbled));
  socket.setNeedClientAuth(option.isAuthPeer());
  return socket;
 } catch (UnknownHostException e) {
  throw new IllegalArgumentException("unkown host");
 } catch (IOException e) {
  throw new IllegalArgumentException("unable create socket");
 }
}

代码示例来源:origin: i2p/i2p.i2p

/**
 * Select protocols and cipher suites to be used
 * based on configured inclusion and exclusion lists
 * as well as enabled and supported protocols and cipher suites.
 *
 * Adapted from Jetty SslContextFactory.java
 *
 * @since 0.9.16
 */
public static void setProtocolsAndCiphers(SSLServerSocket socket) {
  String[] p = selectProtocols(socket.getEnabledProtocols(),
                 socket.getSupportedProtocols());
  for (int i = 0; i < p.length; i++) {
    // if we left SSLv3 in there, we don't support TLS,
    // so we should't remove the SSL ciphers
    if (p[i].equals("SSLv3"))
      return;
  }
  socket.setEnabledProtocols(p);
  socket.setEnabledCipherSuites(selectCipherSuites(socket.getEnabledCipherSuites(),
                           socket.getSupportedCipherSuites()));
}

代码示例来源:origin: tony19/logback-android

public String[] getSupportedCipherSuites() {
 return delegate.getSupportedCipherSuites();
}

代码示例来源:origin: apache/karaf

public String[] getSupportedCipherSuites() {
  return ss.getSupportedCipherSuites();
}

代码示例来源:origin: dCache/dcache

private void setCipherSuiteAndProtocol(SSLServerSocket socket)
  {
    String[] cipherSuites = toArray(filter(asList(socket.getSupportedCipherSuites()),
                        not(in(bannedCiphers))), String.class);
    String[] protocols = toArray(filter(asList(socket.getSupportedProtocols()),
                        not(in(bannedProtocols))), String.class);
    socket.setEnabledCipherSuites(cipherSuites);
    socket.setEnabledProtocols(protocols);
    socket.setWantClientAuth(true);
    socket.setUseClientMode(false);
  }
}

代码示例来源:origin: stackoverflow.com

public class TlsServerSocketFactory implements RMIServerSocketFactory {

  public ServerSocket createServerSocket(int port) throws IOException
  {
    SSLServerSocketFactory sf = ((SSLServerSocketFactory) SSLServerSocketFactory.getDefault());
    SSLServerSocket s = (SSLServerSocket) (sf.createServerSocket(port));

    s.setUseClientMode(false);
    s.setEnabledProtocols(new String[]{"TLSv1.1", "TLSv1.2"}); // NO POODLES HERE!
    s.setEnabledCipherSuites(s.getSupportedCipherSuites());

    return s;
  }
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron

public void setSSLParameters(final SSLContext sslContext, final SSLServerSocket sslServerSocket, final SSLParameters parameters) {
  sslServerSocket.setSSLParameters(redefine(parameters, sslServerSocket.getSupportedCipherSuites(), sslServerSocket.getSupportedProtocols()));
}

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server

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

代码示例来源:origin: lindzh/hasting

private static void postSSLServerSocket(SSLServerSocket sslServerSocket,int sslmode){
    String[] pwdsuits = sslServerSocket.getSupportedCipherSuites();  
    sslServerSocket.setEnabledCipherSuites(pwdsuits);  
    sslServerSocket.setUseClientMode(false);  
    if(sslmode == 2){  
      sslServerSocket.setNeedClientAuth(true);  
    }else{  
      sslServerSocket.setWantClientAuth(true);  
    }
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron

public void configure(final SSLContext context, final SSLServerSocket sslServerSocket) {
  sslServerSocket.setUseClientMode(clientMode);
  final SSLParameters sslParameters = sslServerSocket.getSSLParameters();
  configure(sslParameters, sslServerSocket.getSupportedProtocols(), sslServerSocket.getSupportedCipherSuites());
  sslServerSocket.setSSLParameters(sslParameters);
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

public void configure(final SSLContext context, final SSLServerSocket sslServerSocket) {
  sslServerSocket.setUseClientMode(clientMode);
  final SSLParameters sslParameters = sslServerSocket.getSSLParameters();
  configure(sslParameters, sslServerSocket.getSupportedProtocols(), sslServerSocket.getSupportedCipherSuites());
  sslServerSocket.setSSLParameters(sslParameters);
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron-ssl

public void configure(final SSLContext context, final SSLServerSocket sslServerSocket) {
  sslServerSocket.setUseClientMode(clientMode);
  final SSLParameters sslParameters = sslServerSocket.getSSLParameters();
  configure(sslParameters, sslServerSocket.getSupportedProtocols(), sslServerSocket.getSupportedCipherSuites());
  sslServerSocket.setSSLParameters(sslParameters);
}

代码示例来源:origin: jsevellec/cassandra-unit

/** Sets relevant socket options specified in encryption settings */
private static void prepareSocket(SSLServerSocket serverSocket, EncryptionOptions options)
{
  String[] suites = filterCipherSuites(serverSocket.getSupportedCipherSuites(), options.cipher_suites);
  if(options.require_endpoint_verification)
  {
    SSLParameters sslParameters = serverSocket.getSSLParameters();
    sslParameters.setEndpointIdentificationAlgorithm("HTTPS");
    serverSocket.setSSLParameters(sslParameters);
  }
  serverSocket.setEnabledCipherSuites(suites);
  serverSocket.setNeedClientAuth(options.require_client_auth);
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

/** Sets relevant socket options specified in encryption settings */
private static void prepareSocket(SSLServerSocket serverSocket, EncryptionOptions options)
{
  String[] suites = filterCipherSuites(serverSocket.getSupportedCipherSuites(), options.cipher_suites);
  if(options.require_endpoint_verification)
  {
    SSLParameters sslParameters = serverSocket.getSSLParameters();
    sslParameters.setEndpointIdentificationAlgorithm("HTTPS");
    serverSocket.setSSLParameters(sslParameters);
  }
  serverSocket.setEnabledCipherSuites(suites);
  serverSocket.setNeedClientAuth(options.require_client_auth);
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

/** Sets relevant socket options specified in encryption settings */
private static void prepareSocket(SSLServerSocket serverSocket, EncryptionOptions options)
{
  String[] suites = filterCipherSuites(serverSocket.getSupportedCipherSuites(), options.cipher_suites);
  if(options.require_endpoint_verification)
  {
    SSLParameters sslParameters = serverSocket.getSSLParameters();
    sslParameters.setEndpointIdentificationAlgorithm("HTTPS");
    serverSocket.setSSLParameters(sslParameters);
  }
  serverSocket.setEnabledCipherSuites(suites);
  serverSocket.setNeedClientAuth(options.require_client_auth);
}

相关文章