本文整理了Java中javax.net.ssl.SSLServerSocket.setEnabledCipherSuites()
方法的一些代码示例,展示了SSLServerSocket.setEnabledCipherSuites()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SSLServerSocket.setEnabledCipherSuites()
方法的具体详情如下:
包路径:javax.net.ssl.SSLServerSocket
类名称:SSLServerSocket
方法名:setEnabledCipherSuites
[英]Sets the names of the cipher suites to be enabled for new connections. Only cipher suites returned by #getSupportedCipherSuites() are allowed.
[中]设置要为新连接启用的密码套件的名称。只允许由#GetSupportedCipherSuite()返回的密码套件。
代码示例来源:origin: wildfly/wildfly
public void setEnabledCipherSuites(final String[] names) throws IllegalArgumentException {
delegate.setEnabledCipherSuites(names);
}
代码示例来源:origin: wildfly/wildfly
default void setEnabledCipherSuites(SSLContext sslContext, SSLServerSocket sslServerSocket, String[] suites) {
sslServerSocket.setEnabledCipherSuites(suites);
}
代码示例来源: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: wildfly/wildfly
public ServerSocket createSSLServerSocket(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;
}
代码示例来源:origin: com.h2database/h2
secureSocket.getEnabledCipherSuites(),
secureSocket.getSupportedCipherSuites());
secureSocket.setEnabledCipherSuites(list);
代码示例来源:origin: apache/flume
private TServerTransport getSSLServerTransport() {
try {
TServerTransport transport;
TSSLTransportFactory.TSSLTransportParameters params =
new TSSLTransportFactory.TSSLTransportParameters();
params.setKeyStore(getKeystore(), getKeystorePassword(),
KeyManagerFactory.getDefaultAlgorithm(), getKeystoreType());
transport = TSSLTransportFactory.getServerSocket(
port, 120000, InetAddress.getByName(bindAddress), params);
ServerSocket serverSock = ((TServerSocket) transport).getServerSocket();
if (serverSock instanceof SSLServerSocket) {
SSLServerSocket sslServerSock = (SSLServerSocket) serverSock;
SSLParameters sslParameters = sslServerSock.getSSLParameters();
sslServerSock.setEnabledCipherSuites(getFilteredCipherSuites(sslParameters));
sslServerSock.setEnabledProtocols(getFilteredProtocols(sslParameters));
}
return transport;
} catch (Throwable throwable) {
throw new FlumeException("Cannot start Thrift source.", throwable);
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void setEnabledCipherSuites(String[] suites) {
delegate.setEnabledCipherSuites(suites);
}
代码示例来源:origin: apache/cloudstack
@Override
public SSLServerSocket createSSLServerSocket(int port) throws IOException {
try {
SSLServerSocket srvSock = null;
SSLServerSocketFactory ssf = sslContext.getServerSocketFactory();
srvSock = (SSLServerSocket)ssf.createServerSocket(port);
srvSock.setEnabledProtocols(SSLUtils.getRecommendedProtocols());
srvSock.setEnabledCipherSuites(SSLUtils.getRecommendedCiphers());
s_logger.info("create SSL server socket on port: " + port);
return srvSock;
} catch (Exception ioe) {
s_logger.error(ioe.toString(), ioe);
}
return null;
}
}
代码示例来源:origin: javaee/glassfish
/**
* Configures the given SSL server socket with the requested cipher suites, protocol versions, and need for client
* authentication
*/
protected void initServerSocket(ServerSocket ssocket) {
if (!(ssocket instanceof SSLServerSocket)) {
throw new IllegalArgumentException("The ServerSocket has to be SSLServerSocket");
}
SSLServerSocket socket = (SSLServerSocket) ssocket;
if (attributes.get("ciphers") != 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
if(clientAuthNeed) {
socket.setNeedClientAuth(clientAuthNeed);
} else {
socket.setWantClientAuth(clientAuthWant);
}
}
}
代码示例来源: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: org.apache.thrift/libthrift
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(new TServerSocket.ServerSocketTransportArgs().
serverSocket(serverSocket).clientTimeout(timeout));
} catch (Exception e) {
throw new TTransportException("Could not bind to port " + port, e);
}
}
代码示例来源: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: org.mule/mule-core
private SSLServerSocket restrictCipherSuites(SSLServerSocket sslServerSocket)
{
sslServerSocket.setEnabledCipherSuites(enabledCipherSuites);
sslServerSocket.setEnabledProtocols(enabledProtocols);
return sslServerSocket;
}
}
代码示例来源:origin: org.wildfly.core/wildfly-domain-management
private void setSslParams(final ServerSocket socket) {
if (socket instanceof SSLServerSocket) {
SSLServerSocket sslSocket = (SSLServerSocket) socket;
if (enabledCipherSuites.length > 0) {
sslSocket.setEnabledCipherSuites(enabledCipherSuites);
}
if (enabledProtocols.length > 0) {
sslSocket.setEnabledProtocols(enabledProtocols);
}
}
}
}
代码示例来源:origin: org.apache.flink/flink-runtime
private void configureServerSocket(SSLServerSocket socket) {
socket.setEnabledProtocols(protocols);
socket.setEnabledCipherSuites(cipherSuites);
socket.setNeedClientAuth(true);
}
}
代码示例来源:origin: codefollower/Tomcat-Research
/**
* 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);
}
代码示例来源: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: dcm4che/dcm4che
private ServerSocket createTLSServerSocket(Connection conn)
throws IOException, GeneralSecurityException {
SSLContext sslContext = conn.getDevice().sslContext();
SSLServerSocketFactory ssf = sslContext.getServerSocketFactory();
SSLServerSocket ss = (SSLServerSocket) ssf.createServerSocket();
ss.setEnabledProtocols(conn.getTlsProtocols());
ss.setEnabledCipherSuites(conn.getTlsCipherSuites());
ss.setNeedClientAuth(conn.isTlsNeedClientAuth());
return ss;
}
代码示例来源: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.dcm4che/dcm4che-net
private ServerSocket createTLSServerSocket(Connection conn)
throws IOException, GeneralSecurityException {
SSLContext sslContext = conn.getDevice().sslContext();
SSLServerSocketFactory ssf = sslContext.getServerSocketFactory();
SSLServerSocket ss = (SSLServerSocket) ssf.createServerSocket();
ss.setEnabledProtocols(conn.getTlsProtocols());
ss.setEnabledCipherSuites(conn.getTlsCipherSuites());
ss.setNeedClientAuth(conn.isTlsNeedClientAuth());
return ss;
}
内容来源于网络,如有侵权,请联系作者删除!