io.netty.handler.ssl.OpenSsl.isTlsv13Supported()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(229)

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

OpenSsl.isTlsv13Supported介绍

暂无

代码示例

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

  1. @Override
  2. public final void setEnabledCipherSuites(String[] cipherSuites) {
  3. checkNotNull(cipherSuites, "cipherSuites");
  4. final StringBuilder buf = new StringBuilder();
  5. final StringBuilder bufTLSv13 = new StringBuilder();
  6. CipherSuiteConverter.convertToCipherStrings(Arrays.asList(cipherSuites), buf, bufTLSv13, OpenSsl.isBoringSSL());
  7. final String cipherSuiteSpec = buf.toString();
  8. final String cipherSuiteSpecTLSv13 = bufTLSv13.toString();
  9. if (!OpenSsl.isTlsv13Supported() && !cipherSuiteSpecTLSv13.isEmpty()) {
  10. throw new IllegalArgumentException("TLSv1.3 is not supported by this java version.");
  11. }
  12. synchronized (this) {
  13. if (!isDestroyed()) {
  14. // TODO: Should we also adjust the protocols based on if there are any ciphers left that can be used
  15. // for TLSv1.3 or for previor SSL/TLS versions ?
  16. try {
  17. // Set non TLSv1.3 ciphers.
  18. SSL.setCipherSuites(ssl, cipherSuiteSpec, false);
  19. if (OpenSsl.isTlsv13Supported()) {
  20. // Set TLSv1.3 ciphers.
  21. SSL.setCipherSuites(ssl, cipherSuiteSpecTLSv13, true);
  22. }
  23. } catch (Exception e) {
  24. throw new IllegalStateException("failed to enable cipher suites: " + cipherSuiteSpec, e);
  25. }
  26. } else {
  27. throw new IllegalStateException("failed to enable cipher suites: " + cipherSuiteSpec);
  28. }
  29. }
  30. }

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

  1. @Override
  2. public final String[] getEnabledCipherSuites() {
  3. final String[] enabled;
  4. synchronized (this) {
  5. if (!isDestroyed()) {
  6. enabled = SSL.getCiphers(ssl);
  7. } else {
  8. return EmptyArrays.EMPTY_STRINGS;
  9. }
  10. }
  11. if (enabled == null) {
  12. return EmptyArrays.EMPTY_STRINGS;
  13. } else {
  14. List<String> enabledList = new ArrayList<String>();
  15. synchronized (this) {
  16. for (int i = 0; i < enabled.length; i++) {
  17. String mapped = toJavaCipherSuite(enabled[i]);
  18. final String cipher = mapped == null ? enabled[i] : mapped;
  19. if (!OpenSsl.isTlsv13Supported() && SslUtils.isTLSv13Cipher(cipher)) {
  20. continue;
  21. }
  22. enabledList.add(cipher);
  23. }
  24. }
  25. return enabledList.toArray(new String[0]);
  26. }
  27. }

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

  1. int protocolOpts = SSL.SSL_PROTOCOL_SSLV3 | SSL.SSL_PROTOCOL_TLSV1 |
  2. SSL.SSL_PROTOCOL_TLSV1_1 | SSL.SSL_PROTOCOL_TLSV1_2;
  3. if (OpenSsl.isTlsv13Supported()) {
  4. protocolOpts |= SSL.SSL_PROTOCOL_TLSV1_3;
  5. boolean tlsv13Supported = OpenSsl.isTlsv13Supported();
  6. StringBuilder cipherBuilder = new StringBuilder();
  7. StringBuilder cipherTLSv13Builder = new StringBuilder();

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

  1. @Override
  2. public final void setEnabledCipherSuites(String[] cipherSuites) {
  3. checkNotNull(cipherSuites, "cipherSuites");
  4. final StringBuilder buf = new StringBuilder();
  5. final StringBuilder bufTLSv13 = new StringBuilder();
  6. CipherSuiteConverter.convertToCipherStrings(Arrays.asList(cipherSuites), buf, bufTLSv13, OpenSsl.isBoringSSL());
  7. final String cipherSuiteSpec = buf.toString();
  8. final String cipherSuiteSpecTLSv13 = bufTLSv13.toString();
  9. if (!OpenSsl.isTlsv13Supported() && !cipherSuiteSpecTLSv13.isEmpty()) {
  10. throw new IllegalArgumentException("TLSv1.3 is not supported by this java version.");
  11. }
  12. synchronized (this) {
  13. if (!isDestroyed()) {
  14. // TODO: Should we also adjust the protocols based on if there are any ciphers left that can be used
  15. // for TLSv1.3 or for previor SSL/TLS versions ?
  16. try {
  17. // Set non TLSv1.3 ciphers.
  18. SSL.setCipherSuites(ssl, cipherSuiteSpec, false);
  19. if (OpenSsl.isTlsv13Supported()) {
  20. // Set TLSv1.3 ciphers.
  21. SSL.setCipherSuites(ssl, cipherSuiteSpecTLSv13, true);
  22. }
  23. } catch (Exception e) {
  24. throw new IllegalStateException("failed to enable cipher suites: " + cipherSuiteSpec, e);
  25. }
  26. } else {
  27. throw new IllegalStateException("failed to enable cipher suites: " + cipherSuiteSpec);
  28. }
  29. }
  30. }

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

  1. @Override
  2. public final String[] getEnabledCipherSuites() {
  3. final String[] enabled;
  4. synchronized (this) {
  5. if (!isDestroyed()) {
  6. enabled = SSL.getCiphers(ssl);
  7. } else {
  8. return EmptyArrays.EMPTY_STRINGS;
  9. }
  10. }
  11. if (enabled == null) {
  12. return EmptyArrays.EMPTY_STRINGS;
  13. } else {
  14. List<String> enabledList = new ArrayList<String>();
  15. synchronized (this) {
  16. for (int i = 0; i < enabled.length; i++) {
  17. String mapped = toJavaCipherSuite(enabled[i]);
  18. final String cipher = mapped == null ? enabled[i] : mapped;
  19. if (!OpenSsl.isTlsv13Supported() && SslUtils.isTLSv13Cipher(cipher)) {
  20. continue;
  21. }
  22. enabledList.add(cipher);
  23. }
  24. }
  25. return enabledList.toArray(new String[0]);
  26. }
  27. }

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

  1. int protocolOpts = SSL.SSL_PROTOCOL_SSLV3 | SSL.SSL_PROTOCOL_TLSV1 |
  2. SSL.SSL_PROTOCOL_TLSV1_1 | SSL.SSL_PROTOCOL_TLSV1_2;
  3. if (OpenSsl.isTlsv13Supported()) {
  4. protocolOpts |= SSL.SSL_PROTOCOL_TLSV1_3;
  5. boolean tlsv13Supported = OpenSsl.isTlsv13Supported();
  6. StringBuilder cipherBuilder = new StringBuilder();
  7. StringBuilder cipherTLSv13Builder = new StringBuilder();

相关文章