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

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

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

SSLEngine.getSupportedProtocols介绍

[英]Returns the protocol names that are supported by this engine. These protocols can be enables using #setEnabledProtocols(String[]).
[中]返回此引擎支持的协议名称。可以使用#setEnabledProtocols(字符串[])启用这些协议。

代码示例

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

  1. @Override
  2. public String[] getSupportedProtocols() {
  3. return engine.getSupportedProtocols();
  4. }

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

  1. @Override
  2. public String[] getSupportedProtocols() {
  3. return delegate.getSupportedProtocols();
  4. }

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

  1. @Override
  2. public String[] getSupportedProtocols() {
  3. return delegate.getSupportedProtocols();
  4. }

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

  1. @Override
  2. public String[] getSupportedProtocols() {
  3. return engine.getSupportedProtocols();
  4. }

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

  1. public String[] getSupportedProtocols() {
  2. return delegate.getSupportedProtocols();
  3. }

代码示例来源:origin: io.netty/netty

  1. @Override
  2. public String[] getSupportedProtocols() {
  3. return engine.getSupportedProtocols();
  4. }

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

  1. public String[] getSupportedProtocols() {
  2. return currentRef.get().getSupportedProtocols();
  3. }

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

  1. public String[] getSupportedProtocols() {
  2. return currentRef.get().getSupportedProtocols();
  3. }

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

  1. public String[] getSupportedProtocols() {
  2. return currentRef.get().getSupportedProtocols();
  3. }

代码示例来源:origin: igniterealtime/Openfire

  1. /**
  2. * Returns the names of all encryption protocols that are supported (but not necessarily enabled).
  3. *
  4. * @return An array of protocol names. Not expected to be empty.
  5. */
  6. public static List<String> getSupportedProtocols() throws NoSuchAlgorithmException, KeyManagementException
  7. {
  8. // TODO Might want to cache the result. It's unlikely to change at runtime.
  9. final SSLContext context = SSLContext.getInstance( "TLSv1" );
  10. context.init( null, null, null );
  11. return Arrays.asList( context.createSSLEngine().getSupportedProtocols() );
  12. }

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

  1. private static String[] defaultProtocols(SSLEngine engine) {
  2. // Choose the sensible default list of protocols.
  3. final String[] supportedProtocols = engine.getSupportedProtocols();
  4. Set<String> supportedProtocolsSet = new HashSet<String>(supportedProtocols.length);
  5. for (int i = 0; i < supportedProtocols.length; ++i) {
  6. supportedProtocolsSet.add(supportedProtocols[i]);
  7. }
  8. List<String> protocols = new ArrayList<String>();
  9. addIfSupported(
  10. supportedProtocolsSet, protocols,
  11. // Do not include TLSv1.3 for now by default.
  12. SslUtils.PROTOCOL_TLS_V1_2, SslUtils.PROTOCOL_TLS_V1_1, SslUtils.PROTOCOL_TLS_V1);
  13. if (!protocols.isEmpty()) {
  14. return protocols.toArray(new String[0]);
  15. }
  16. return engine.getEnabledProtocols();
  17. }

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

  1. supportedProtocols.addAll(Arrays.asList(SSLContext.getDefault().createSSLEngine().getSupportedProtocols()));
  2. } catch (NoSuchAlgorithmException e) {

代码示例来源:origin: eclipse-vertx/vert.x

  1. protocols.retainAll(Arrays.asList(engine.getSupportedProtocols()));
  2. if (protocols.isEmpty()) {
  3. log.warn("no SSL/TLS protocols are enabled due to configuration restrictions");

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

  1. final Set<String> supported = new HashSet<String>(Arrays.asList(engine.getSupportedProtocols()));
  2. final List<String> finalList = new ArrayList<String>();
  3. for (String name : protocols) {

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

  1. public void configure(final SSLContext context, final SSLEngine sslEngine) {
  2. sslEngine.setUseClientMode(clientMode);
  3. final SSLParameters sslParameters = sslEngine.getSSLParameters();
  4. configure(sslParameters, sslEngine.getSupportedProtocols(), sslEngine.getSupportedCipherSuites());
  5. sslEngine.setSSLParameters(sslParameters);
  6. }

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

  1. private void logSupportedParameters(SslContextFactory contextFactory) {
  2. if (LOGGED.compareAndSet(false, true)) {
  3. // When Jetty logs out which protocols are enabled / disabled they include tracing
  4. // information to detect if the protocol was disabled at the
  5. // JRE/lib/security/java.security level. Since we don't log this information we take the
  6. // SSLEngine from our context instead of a pristine version.
  7. //
  8. // For more info from Jetty:
  9. // https://github.com/eclipse/jetty.project/blob/93a8afcc6bd1a6e0af7bd9f967c97ae1bc3eb718/jetty-util/src/main/java/org/eclipse/jetty/util/ssl/SslContextFactory.java#L356-L360
  10. final SSLEngine engine = contextFactory.getSslContext().createSSLEngine();
  11. final Map<Boolean, List<String>> protocols = partitionSupport(
  12. engine.getSupportedProtocols(),
  13. engine.getEnabledProtocols(),
  14. contextFactory.getExcludeProtocols(),
  15. contextFactory.getIncludeProtocols()
  16. );
  17. final Map<Boolean, List<String>> ciphers = partitionSupport(
  18. engine.getSupportedCipherSuites(),
  19. engine.getEnabledCipherSuites(),
  20. contextFactory.getExcludeCipherSuites(),
  21. contextFactory.getIncludeCipherSuites()
  22. );
  23. LOGGER.info("Enabled protocols: {}", protocols.get(true));
  24. LOGGER.info("Disabled protocols: {}", protocols.get(false));
  25. LOGGER.info("Enabled cipher suites: {}", ciphers.get(true));
  26. LOGGER.info("Disabled cipher suites: {}", ciphers.get(false));
  27. }
  28. }

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

  1. public void setSSLParameters(final SSLContext sslContext, final SSLEngine sslEngine, final SSLParameters parameters) {
  2. sslEngine.setSSLParameters(redefine(parameters, sslEngine.getSupportedCipherSuites(), sslEngine.getSupportedProtocols()));
  3. }

代码示例来源:origin: Netflix/zuul

  1. LOG.debug("ssl protocols supported: {}", String.join(", ", sslHandler.engine().getSupportedProtocols()));
  2. LOG.debug("ssl protocols enabled: {}", String.join(", ", sslHandler.engine().getEnabledProtocols()));

代码示例来源:origin: apache/incubator-druid

  1. @Override
  2. public void start() throws Exception
  3. {
  4. log.info("Starting Jetty Server...");
  5. server.start();
  6. if (node.isEnableTlsPort()) {
  7. // Perform validation
  8. Preconditions.checkNotNull(sslContextFactory);
  9. final SSLEngine sslEngine = sslContextFactory.newSSLEngine();
  10. if (sslEngine.getEnabledCipherSuites() == null || sslEngine.getEnabledCipherSuites().length == 0) {
  11. throw new ISE(
  12. "No supported cipher suites found, supported suites [%s], configured suites include list: [%s] exclude list: [%s]",
  13. Arrays.toString(sslEngine.getSupportedCipherSuites()),
  14. tlsServerConfig.getIncludeCipherSuites(),
  15. tlsServerConfig.getExcludeCipherSuites()
  16. );
  17. }
  18. if (sslEngine.getEnabledProtocols() == null || sslEngine.getEnabledProtocols().length == 0) {
  19. throw new ISE(
  20. "No supported protocols found, supported protocols [%s], configured protocols include list: [%s] exclude list: [%s]",
  21. Arrays.toString(sslEngine.getSupportedProtocols()),
  22. tlsServerConfig.getIncludeProtocols(),
  23. tlsServerConfig.getExcludeProtocols()
  24. );
  25. }
  26. }
  27. }

代码示例来源:origin: Netflix/zuul

  1. LOG.debug("ssl protocols supported: {}", String.join(", ", sslHandler.engine().getSupportedProtocols()));
  2. LOG.debug("ssl protocols enabled: {}", String.join(", ", sslHandler.engine().getEnabledProtocols()));

相关文章