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

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

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

OpenSsl.versionString介绍

[英]Returns the version string of the used available OpenSSL library or null if #isAvailable()returns false.
[中]返回已使用的可用OpenSSL库的版本字符串,如果#isAvailable()返回false,则返回null。

代码示例

代码示例来源:origin: floragunncom/search-guard-ssl

  1. private void logOpenSSLInfos() {
  2. if (OpenSsl.isAvailable()) {
  3. log.info("OpenSSL " + OpenSsl.versionString() + " (" + OpenSsl.version() + ") available");
  4. if (OpenSsl.version() < 0x10002000L) {
  5. log.warn(
  6. "Outdated OpenSSL version detected. You should update to 1.0.2k or later. Currently installed: "
  7. + OpenSsl.versionString());
  8. }
  9. if (!OpenSsl.supportsHostnameValidation()) {
  10. log.warn("Your OpenSSL version " + OpenSsl.versionString()
  11. + " does not support hostname verification. You should update to 1.0.2k or later.");
  12. }
  13. log.debug("OpenSSL available ciphers " + OpenSsl.availableOpenSslCipherSuites());
  14. } else {
  15. log.info("OpenSSL not available (this is not an error, we simply fallback to built-in JDK SSL) because of "
  16. + OpenSsl.unavailabilityCause());
  17. }
  18. }

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

  1. @Test(timeout = 30000)
  2. public void testSslRenegotiationRejected() throws Throwable {
  3. // BoringSSL does not support renegotiation intentionally.
  4. Assume.assumeFalse("BoringSSL".equals(OpenSsl.versionString()));
  5. Assume.assumeTrue(OpenSsl.isAvailable());
  6. run();
  7. }

代码示例来源:origin: apache/qpid-jms

  1. /**
  2. * Determines if Netty OpenSSL support is available and applicable based on the configuration
  3. * in the given TransportOptions instance.
  4. *
  5. * @param options
  6. * The configuration of the Transport being created.
  7. *
  8. * @return true if OpenSSL support is available and usable given the requested configuration.
  9. */
  10. public static boolean isOpenSSLPossible(TransportOptions options) {
  11. boolean result = false;
  12. if (options.isUseOpenSSL()) {
  13. if (!OpenSsl.isAvailable()) {
  14. LOG.debug("OpenSSL could not be enabled because a suitable implementation could not be found.", OpenSsl.unavailabilityCause());
  15. } else if (options.getSslContextOverride() != null) {
  16. LOG.debug("OpenSSL could not be enabled due to user SSLContext being supplied.");
  17. } else if (!OpenSsl.supportsKeyManagerFactory()) {
  18. LOG.debug("OpenSSL could not be enabled because the version provided does not allow a KeyManagerFactory to be used.");
  19. } else if (options.isVerifyHost() && !OpenSsl.supportsHostnameValidation()) {
  20. LOG.debug("OpenSSL could not be enabled due to verifyHost being enabled but not supported by the provided OpenSSL version.");
  21. } else if (options.getKeyAlias() != null) {
  22. LOG.debug("OpenSSL could not be enabled because a keyAlias is set and that feature is not supported for OpenSSL.");
  23. } else {
  24. LOG.debug("OpenSSL Enabled: Version {} of OpenSSL will be used", OpenSsl.versionString());
  25. result = true;
  26. }
  27. }
  28. return result;
  29. }

代码示例来源:origin: floragunncom/search-guard-ssl

  1. log.debug("OPENSSL "+OpenSsl.versionString()+" supports the following ciphers (java-style) {}", OpenSsl.availableJavaCipherSuites());
  2. log.debug("OPENSSL "+OpenSsl.versionString()+" supports the following ciphers (openssl-style) {}", OpenSsl.availableOpenSslCipherSuites());

代码示例来源:origin: org.apache.qpid/qpid-jms-client

  1. /**
  2. * Determines if Netty OpenSSL support is available and applicable based on the configuration
  3. * in the given TransportOptions instance.
  4. *
  5. * @param options
  6. * The configuration of the Transport being created.
  7. *
  8. * @return true if OpenSSL support is available and usable given the requested configuration.
  9. */
  10. public static boolean isOpenSSLPossible(TransportOptions options) {
  11. boolean result = false;
  12. if (options.isUseOpenSSL()) {
  13. if (!OpenSsl.isAvailable()) {
  14. LOG.debug("OpenSSL could not be enabled because a suitable implementation could not be found.", OpenSsl.unavailabilityCause());
  15. } else if (options.getSslContextOverride() != null) {
  16. LOG.debug("OpenSSL could not be enabled due to user SSLContext being supplied.");
  17. } else if (!OpenSsl.supportsKeyManagerFactory()) {
  18. LOG.debug("OpenSSL could not be enabled because the version provided does not allow a KeyManagerFactory to be used.");
  19. } else if (options.isVerifyHost() && !OpenSsl.supportsHostnameValidation()) {
  20. LOG.debug("OpenSSL could not be enabled due to verifyHost being enabled but not supported by the provided OpenSSL version.");
  21. } else if (options.getKeyAlias() != null) {
  22. LOG.debug("OpenSSL could not be enabled because a keyAlias is set and that feature is not supported for OpenSSL.");
  23. } else {
  24. LOG.debug("OpenSSL Enabled: Version {} of OpenSSL will be used", OpenSsl.versionString());
  25. result = true;
  26. }
  27. }
  28. return result;
  29. }

代码示例来源:origin: floragunncom/search-guard-ssl

  1. builder.field("ssl_openssl_available", OpenSsl.isAvailable());
  2. builder.field("ssl_openssl_version", OpenSsl.version());
  3. builder.field("ssl_openssl_version_string", OpenSsl.versionString());
  4. Throwable openSslUnavailCause = OpenSsl.unavailabilityCause();
  5. builder.field("ssl_openssl_non_available_cause", openSslUnavailCause==null?"":openSslUnavailCause.toString());

代码示例来源:origin: eclipse/hono

  1. OpenSsl.versionString());
  2. serverOptions.setSslEngineOptions(new OpenSSLEngineOptions());
  3. } else {

代码示例来源:origin: org.eclipse.hono/hono-service-base

  1. OpenSsl.versionString());
  2. serverOptions.setSslEngineOptions(new OpenSSLEngineOptions());
  3. } else {

代码示例来源:origin: org.eclipse.hono/hono-core

  1. OpenSsl.versionString());
  2. clientOptions.setSslEngineOptions(new OpenSSLEngineOptions());
  3. } else {

代码示例来源:origin: eclipse/hono

  1. OpenSsl.versionString());
  2. clientOptions.setSslEngineOptions(new OpenSSLEngineOptions());
  3. } else {

代码示例来源:origin: org.infinispan/infinispan-server-rest

  1. @Test
  2. public void shouldUpgradeUsingALPN() throws Exception {
  3. SkipTestNG.skipSinceJDK(10); // TODO: OpenSSL ALPN doesn't seem to work. Restructure the test to use internal JDK ALPN
  4. if (!OpenSsl.isAlpnSupported()) {
  5. throw new IllegalStateException("OpenSSL is not present, can not test TLS/ALPN support. Version: " + OpenSsl.versionString() + " Cause: " + OpenSsl.unavailabilityCause());
  6. }
  7. //given
  8. restServer = RestServerHelper.defaultRestServer("http2testcache")
  9. .withKeyStore(KEY_STORE_PATH, "secret", "pkcs12")
  10. .start(TestResourceTracker.getCurrentTestShortName());
  11. client = NettyHttpClient.newHttp2ClientWithALPN(KEY_STORE_PATH, "secret");
  12. client.start(restServer.getHost(), restServer.getPort());
  13. FullHttpRequest putValueInCacheRequest = new DefaultFullHttpRequest(HTTP_1_1, POST, "/rest/http2testcache/test",
  14. wrappedBuffer("test".getBytes(CharsetUtil.UTF_8)));
  15. //when
  16. client.sendRequest(putValueInCacheRequest);
  17. Queue<FullHttpResponse> responses = client.getResponses();
  18. //then
  19. Assertions.assertThat(responses).hasSize(1);
  20. Assertions.assertThat(responses.element().status().code()).isEqualTo(200);
  21. Assertions.assertThat(restServer.getCacheManager().getCache("http2testcache").size()).isEqualTo(1);
  22. }

代码示例来源:origin: org.infinispan/infinispan-server-router

  1. @Test
  2. public void shouldUpgradeThroughALPN() throws Exception {
  3. if (!OpenSsl.isAlpnSupported()) {
  4. throw new IllegalStateException("OpenSSL is not present, can not test TLS/ALPN support. Version: " + OpenSsl.versionString() + " Cause: " + OpenSsl.unavailabilityCause());

代码示例来源:origin: org.infinispan/infinispan-server-router

  1. @Test
  2. public void shouldUpgradeToHotRodThroughALPN() throws Exception {
  3. if (!OpenSsl.isAlpnSupported()) {
  4. throw new IllegalStateException("OpenSSL is not present, can not test TLS/ALPN support. Version: " + OpenSsl.versionString() + " Cause: " + OpenSsl.unavailabilityCause());

相关文章