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

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

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

SSLServerSocket.setUseClientMode介绍

[英]Sets whether new connections should act in client mode when handshaking.
[中]设置握手时新连接是否应在客户端模式下运行。

代码示例

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

default void setUseClientMode(SSLContext sslContext, SSLServerSocket sslServerSocket, boolean mode) {
  sslServerSocket.setUseClientMode(mode);
}

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

public void setUseClientMode(final boolean clientMode) {
  delegate.setUseClientMode(clientMode);
}

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

private SSLServerSocket configureSSLServerSocket(SSLServerSocket socket) {
  SSLParameters sslParameters = socket.getSSLParameters();
  configureSslParameters(sslParameters, false);
  socket.setSSLParameters(sslParameters);
  socket.setUseClientMode(false);
  return socket;
}

代码示例来源:origin: NanoHttpd/nanohttpd

@Override
public ServerSocket create() throws IOException {
  SSLServerSocket ss = null;
  ss = (SSLServerSocket) this.sslServerSocketFactory.createServerSocket();
  if (this.sslProtocols != null) {
    ss.setEnabledProtocols(this.sslProtocols);
  } else {
    ss.setEnabledProtocols(ss.getSupportedProtocols());
  }
  ss.setUseClientMode(false);
  ss.setWantClientAuth(false);
  ss.setNeedClientAuth(false);
  return ss;
}

代码示例来源: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: apache/geode

/**
 * 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);
 }
}

代码示例来源:origin: commons-net/commons-net

/**
   * Sets the socket so newly accepted connections will use SSL client mode.
   *
   * @param socket the SSLServerSocket to initialise
   * @return the socket
   * @throws ClassCastException if socket is not an instance of SSLServerSocket
   */
  public ServerSocket init(ServerSocket socket) {
    ((SSLServerSocket) socket).setUseClientMode(true);
    return socket;
  }
}

代码示例来源:origin: commons-net/commons-net

/** @param socket the socket
 * @return the socket
 * @throws IOException  on error
 * @deprecated  (2.2) use {@link FTPSServerSocketFactory#init(java.net.ServerSocket)} */
@Deprecated
public java.net.ServerSocket init(java.net.ServerSocket socket) throws IOException {
  ((javax.net.ssl.SSLServerSocket) socket).setUseClientMode(true);
  return socket;
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.net

public ServerSocket init(ServerSocket socket) throws IOException {
    ((SSLServerSocket) socket).setUseClientMode(true);
    return socket;
  }
}

代码示例来源:origin: org.xbib/ftp-client

/**
   * Sets the socket so newly accepted connections will use SSL client mode.
   *
   * @param socket the SSLServerSocket to initialise
   * @return the socket
   * @throws ClassCastException if socket is not an instance of SSLServerSocket
   */
  public ServerSocket init(ServerSocket socket) {
    ((SSLServerSocket) socket).setUseClientMode(true);
    return socket;
  }
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/**
   * Sets the socket so newly accepted connections will use SSL client mode.
   *
   * @param socket the SSLServerSocket to initialise
   * @return the socket
   * @throws ClassCastException if socket is not an instance of SSLServerSocket
   */
  public ServerSocket init(ServerSocket socket) {
    ((SSLServerSocket) socket).setUseClientMode(true);
    return socket;
  }
}

代码示例来源:origin: com.arialyy.aria/aria-ftp-plug

/**
  * Sets the socket so newly accepted connections will use SSL client mode.
  *
  * @param socket the SSLServerSocket to initialise
  * @return the socket
  * @throws ClassCastException if socket is not an instance of SSLServerSocket
  */
 public ServerSocket init(ServerSocket socket) {
  ((SSLServerSocket) socket).setUseClientMode(true);
  return socket;
 }
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

/** @deprecated  (2.2) use {@link FTPSServerSocketFactory#init(java.net.ServerSocket)} */
@SuppressWarnings("unused")
@Deprecated
public java.net.ServerSocket init(java.net.ServerSocket socket) throws IOException {
  ((javax.net.ssl.SSLServerSocket) socket).setUseClientMode(true);
  return socket;
}

代码示例来源:origin: com.arialyy.aria/aria-ftp-plug

/**
  * @param socket the socket
  * @return the socket
  * @throws IOException on error
  * @deprecated (2.2) use {@link FTPSServerSocketFactory#init(java.net.ServerSocket)}
  */
 @Deprecated public java.net.ServerSocket init(java.net.ServerSocket socket) throws IOException {
  ((javax.net.ssl.SSLServerSocket) socket).setUseClientMode(true);
  return socket;
 }
}

代码示例来源: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: 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.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: 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);
}

相关文章