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

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

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

OpenSsl.isAvailable介绍

[英]Returns true if and only if netty-tcnative and its OpenSSL support are available.
[中]当且仅当netty-tcnative及其OpenSSL支持可用时,返回true。

代码示例

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

/**
 * @return when OpenSSL is available
 */
public static boolean isAvailable() {
 return OpenSsl.isAvailable();
}

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

private static SslProvider defaultProvider() {
  if (OpenSsl.isAvailable()) {
    return SslProvider.OPENSSL;
  } else {
    return SslProvider.JDK;
  }
}

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

private static SslProvider defaultProvider() {
  if (OpenSsl.isAvailable()) {
    return SslProvider.OPENSSL;
  } else {
    return SslProvider.JDK;
  }
}

代码示例来源:origin: lettuce-io/lettuce-core

private Builder sslProvider(SslProvider sslProvider) {
  if (sslProvider == SslProvider.OPENSSL) {
    if (!OpenSsl.isAvailable()) {
      throw new IllegalStateException("OpenSSL SSL Provider is not available");
    }
  }
  this.sslProvider = sslProvider;
  return this;
}

代码示例来源:origin: Graylog2/graylog2-server

private SslProvider detectTlsProvider() {
  if (OpenSsl.isAvailable()) {
    LOG.debug("Using OpenSSL for Netty transports.");
    return SslProvider.OPENSSL;
  } else {
    LOG.debug("Using default Java TLS provider for Netty transports.");
    return SslProvider.JDK;
  }
}

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

/**
 * Returns the version string of the used available OpenSSL library or {@code null} if {@link #isAvailable()}
 * returns {@code false}.
 */
public static String versionString() {
  return isAvailable() ? SSL.versionString() : null;
}

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

private static int checkErrorCode(int errorCode) {
    // Call OpenSsl.isAvailable() to ensure we try to load the native lib as CertificateVerifier.isValid(...)
    // will depend on it. If loading fails we will just skip the validation.
    if (OpenSsl.isAvailable() && !CertificateVerifier.isValid(errorCode)) {
      throw new IllegalArgumentException("errorCode '" + errorCode +
          "' invalid, see https://www.openssl.org/docs/man1.0.2/apps/verify.html.");
    }
    return errorCode;
  }
}

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

/**
 * Returns the version of the used available OpenSSL library or {@code -1} if {@link #isAvailable()}
 * returns {@code false}.
 */
public static int version() {
  return isAvailable() ? SSL.version() : -1;
}

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

/**
 * Returns the version of the used available OpenSSL library or {@code -1} if {@link #isAvailable()}
 * returns {@code false}.
 */
public static int version() {
  return isAvailable() ? SSL.version() : -1;
}

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

/**
 * Returns the version string of the used available OpenSSL library or {@code null} if {@link #isAvailable()}
 * returns {@code false}.
 */
public static String versionString() {
  return isAvailable() ? SSL.versionString() : null;
}

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

private static int checkErrorCode(int errorCode) {
    // Call OpenSsl.isAvailable() to ensure we try to load the native lib as CertificateVerifier.isValid(...)
    // will depend on it. If loading fails we will just skip the validation.
    if (OpenSsl.isAvailable() && !CertificateVerifier.isValid(errorCode)) {
      throw new IllegalArgumentException("errorCode '" + errorCode +
          "' invalid, see https://www.openssl.org/docs/man1.0.2/apps/verify.html.");
    }
    return errorCode;
  }
}

代码示例来源:origin: blynkkk/blynk-server

static boolean isOpenSslAvailable() {
  return PlatformDependent.bitMode() != 32 && OpenSsl.isAvailable();
}

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

public static SslProvider chooseSslProvider() {
  // Use openssl only if available and has ALPN support (ie. version > 1.0.2).
  SslProvider sslProvider;
  if (ALLOW_USE_OPENSSL.get() && OpenSsl.isAvailable() && OpenSsl.isAlpnSupported()) {
    sslProvider = SslProvider.OPENSSL;
  }
  else {
    sslProvider = SslProvider.JDK;
  }
  return sslProvider;
}

代码示例来源:origin: JZ-Darkal/AndroidHttpCapture

@Override
  public List<String> get() {
    List<String> ciphers;
    if (OpenSsl.isAvailable()) {
      // TODO: consider switching to the list of all available ciphers using OpenSsl.availableCipherSuites()
      ciphers = getBuiltInCipherList();
    } else {
      ciphers = getEnabledJdkCipherSuites();
      if (ciphers.isEmpty()) {
        // could not retrieve the list of enabled ciphers from the JDK SSLContext, so use the hard-coded list
        ciphers = getBuiltInCipherList();
      }
    }
    return ciphers;
  }
});

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

public static SslProvider chooseSslProvider() {
  // Use openssl only if available and has ALPN support (ie. version > 1.0.2).
  SslProvider sslProvider;
  if (ALLOW_USE_OPENSSL.get() && OpenSsl.isAvailable() && OpenSsl.isAlpnSupported()) {
    sslProvider = SslProvider.OPENSSL;
  }
  else {
    sslProvider = SslProvider.JDK;
  }
  return sslProvider;
}

代码示例来源:origin: relayrides/pushy

if (OpenSsl.isAvailable()) {
  log.info("Native SSL provider is available; will use native provider.");
  sslProvider = SslProvider.OPENSSL_REFCNT;

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

@Test
public void testEnsureOpenSSLAvailability() {
  Assume.assumeTrue(allowOpenSSL);
  Assert.assertTrue(String.valueOf(OpenSsl.unavailabilityCause()), OpenSsl.isAvailable());
}

代码示例来源:origin: relayrides/pushy

if (OpenSsl.isAvailable()) {
  log.info("Native SSL provider is available; will use native provider.");
  sslProvider = SslProvider.OPENSSL;

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

if (OpenSsl.isAvailable()) {
  provider = SslProvider.OPENSSL;
  LOGGER.info("Using OpenSSL provider");

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

engineOptions = new JdkSSLEngineOptions();
} else if (engineOptions instanceof OpenSSLEngineOptions) {
 if (!OpenSsl.isAvailable()) {
  VertxException ex = new VertxException("OpenSSL is not available");
  Throwable cause = OpenSsl.unavailabilityCause();

相关文章