List of usage examples for javax.net.ssl SSLContext getSupportedSSLParameters
public final SSLParameters getSupportedSSLParameters()
From source file:com.mirth.connect.util.MirthSSLUtil.java
public static String[] getEnabledHttpsProtocols(String[] requestedProtocols) { logger.debug("Requested SSL protocols: " + Arrays.toString(requestedProtocols)); SSLContext sslContext = SSLContexts.createDefault(); String[] supportedProtocols = sslContext.getSupportedSSLParameters().getProtocols(); Set<String> enabledProtocols = new LinkedHashSet<String>(); for (String protocol : requestedProtocols) { if (ArrayUtils.contains(supportedProtocols, protocol)) { enabledProtocols.add(protocol); }// w ww . j a v a 2s . com } logger.debug("Enabled SSL protocols: " + String.valueOf(enabledProtocols)); return enabledProtocols.toArray(new String[enabledProtocols.size()]); }
From source file:com.mirth.connect.util.MirthSSLUtil.java
public static String[] getEnabledHttpsCipherSuites(String[] requestedCipherSuites) { logger.debug("Requested SSL cipher suites: " + Arrays.toString(requestedCipherSuites)); SSLContext sslContext = SSLContexts.createDefault(); String[] supportedCipherSuites = sslContext.getSupportedSSLParameters().getCipherSuites(); Set<String> enabledCipherSuites = new LinkedHashSet<String>(); for (String cipherSuite : requestedCipherSuites) { if (ArrayUtils.contains(supportedCipherSuites, cipherSuite)) { enabledCipherSuites.add(cipherSuite); }/*from w w w .ja v a2s .c om*/ } logger.debug("Enabled SSL cipher suites: " + String.valueOf(enabledCipherSuites)); return enabledCipherSuites.toArray(new String[enabledCipherSuites.size()]); }
From source file:com.openshift.internal.restclient.http.UrlConnectionHttpClient.java
protected String[] getSupportedCiphers(SSLContext sslContext) { return sslContext.getSupportedSSLParameters().getCipherSuites(); }
From source file:org.elasticsearch.xpack.core.ssl.SSLService.java
/** * The {@link SSLParameters} that are associated with the {@code sslContext}. * <p>/*from ww w .j av a 2 s . c o m*/ * This method exists to simplify testing since {@link SSLContext#getSupportedSSLParameters()} is {@code final}. * * @param sslContext The SSL context for the current SSL settings * @return Never {@code null}. */ SSLParameters sslParameters(SSLContext sslContext) { return sslContext.getSupportedSSLParameters(); }
From source file:org.elasticsearch.xpack.core.ssl.SSLService.java
/** * Creates an {@link SSLContext} based on the provided configuration and trust/key managers * @param sslConfiguration the configuration to use for context creation * @param keyManager the key manager to use * @param trustManager the trust manager to use * @return the created SSLContext//from ww w . ja va 2 s. co m */ private SSLContextHolder createSslContext(X509ExtendedKeyManager keyManager, X509ExtendedTrustManager trustManager, SSLConfiguration sslConfiguration) { // Initialize sslContext try { SSLContext sslContext = SSLContext .getInstance(sslContextAlgorithm(sslConfiguration.supportedProtocols())); sslContext.init(new X509ExtendedKeyManager[] { keyManager }, new X509ExtendedTrustManager[] { trustManager }, null); // check the supported ciphers and log them here to prevent spamming logs on every call supportedCiphers(sslContext.getSupportedSSLParameters().getCipherSuites(), sslConfiguration.cipherSuites(), true); return new SSLContextHolder(sslContext, sslConfiguration); } catch (NoSuchAlgorithmException | KeyManagementException e) { throw new ElasticsearchException("failed to initialize the SSLContext", e); } }