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

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

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

SSLEngine.getSupportedCipherSuites介绍

[英]Returns the SSL cipher suite names that are supported by this engine. These cipher suites can be enabled using #setEnabledCipherSuites(String[]).
[中]返回此引擎支持的SSL密码套件名称。可以使用#setEnabledCipherSuite(字符串[])启用这些密码套件。

代码示例

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. /**
  2. * Returns the names of all encryption cipher suites that are supported (but not necessarily enabled).
  3. *
  4. * @return An array of cipher suite names. Not expected to be empty.
  5. */
  6. public static List<String> getSupportedCipherSuites() 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().getSupportedCipherSuites() );
  12. }

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

  1. private static Set<String> supportedCiphers(SSLEngine engine) {
  2. // Choose the sensible default list of cipher suites.
  3. final String[] supportedCiphers = engine.getSupportedCipherSuites();
  4. Set<String> supportedCiphersSet = new LinkedHashSet<String>(supportedCiphers.length);
  5. for (int i = 0; i < supportedCiphers.length; ++i) {
  6. String supportedCipher = supportedCiphers[i];
  7. supportedCiphersSet.add(supportedCipher);
  8. // IBM's J9 JVM utilizes a custom naming scheme for ciphers and only returns ciphers with the "SSL_"
  9. // prefix instead of the "TLS_" prefix (as defined in the JSSE cipher suite names [1]). According to IBM's
  10. // documentation [2] the "SSL_" prefix is "interchangeable" with the "TLS_" prefix.
  11. // See the IBM forum discussion [3] and issue on IBM's JVM [4] for more details.
  12. //[1] http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#ciphersuites
  13. //[2] https://www.ibm.com/support/knowledgecenter/en/SSYKE2_8.0.0/com.ibm.java.security.component.80.doc/
  14. // security-component/jsse2Docs/ciphersuites.html
  15. //[3] https://www.ibm.com/developerworks/community/forums/html/topic?id=9b5a56a9-fa46-4031-b33b-df91e28d77c2
  16. //[4] https://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=71770
  17. if (supportedCipher.startsWith("SSL_")) {
  18. final String tlsPrefixedCipherName = "TLS_" + supportedCipher.substring("SSL_".length());
  19. try {
  20. engine.setEnabledCipherSuites(new String[]{tlsPrefixedCipherName});
  21. supportedCiphersSet.add(tlsPrefixedCipherName);
  22. } catch (IllegalArgumentException ignored) {
  23. // The cipher is not supported ... move on to the next cipher.
  24. }
  25. }
  26. }
  27. return supportedCiphersSet;
  28. }

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

  1. final Sequence<String> cipherSuites = optionMap.get(Options.SSL_ENABLED_CIPHER_SUITES);
  2. if (cipherSuites != null) {
  3. final Set<String> supported = new HashSet<String>(Arrays.asList(engine.getSupportedCipherSuites()));
  4. final List<String> finalList = new ArrayList<String>();
  5. for (String name : cipherSuites) {

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

  1. final Sequence<String> cipherSuites = optionMap.get(Options.SSL_ENABLED_CIPHER_SUITES);
  2. if (cipherSuites != null) {
  3. final Set<String> supported = new HashSet<String>(Arrays.asList(engine.getSupportedCipherSuites()));
  4. final List<String> finalList = new ArrayList<String>();
  5. for (String name : cipherSuites) {

代码示例来源: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. final String[] cipherSuites = AbstractAcceptingSslChannel.this.cipherSuites;
  2. if (cipherSuites != null) {
  3. final Set<String> supported = new HashSet<String>(Arrays.asList(engine.getSupportedCipherSuites()));
  4. final List<String> finalList = new ArrayList<String>();
  5. for (String name : cipherSuites) {

代码示例来源: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 enabled: {}", String.join(", ", sslHandler.engine().getEnabledProtocols()));
  2. LOG.debug("ssl ciphers supported: {}", String.join(", ", sslHandler.engine().getSupportedCipherSuites()));
  3. LOG.debug("ssl ciphers enabled: {}", String.join(", ", sslHandler.engine().getEnabledCipherSuites()));

代码示例来源: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 enabled: {}", String.join(", ", sslHandler.engine().getEnabledProtocols()));
  2. LOG.debug("ssl ciphers supported: {}", String.join(", ", sslHandler.engine().getSupportedCipherSuites()));
  3. LOG.debug("ssl ciphers enabled: {}", String.join(", ", sslHandler.engine().getEnabledCipherSuites()));

相关文章