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

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

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

OpenSsl.supportsHostnameValidation介绍

[英]Returns true if Hostname Validation is supported when using OpenSSL.
[中]如果使用OpenSSL时支持Hostname Validation,则返回true。

代码示例

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

private void logOpenSSLInfos() {
  if (OpenSsl.isAvailable()) {
    log.info("OpenSSL " + OpenSsl.versionString() + " (" + OpenSsl.version() + ") available");
    if (OpenSsl.version() < 0x10002000L) {
      log.warn(
          "Outdated OpenSSL version detected. You should update to 1.0.2k or later. Currently installed: "
              + OpenSsl.versionString());
    }
    if (!OpenSsl.supportsHostnameValidation()) {
      log.warn("Your OpenSSL version " + OpenSsl.versionString()
          + " does not support hostname verification. You should update to 1.0.2k or later.");
    }
    log.debug("OpenSSL available ciphers " + OpenSsl.availableOpenSslCipherSuites());
  } else {
    log.info("OpenSSL not available (this is not an error, we simply fallback to built-in JDK SSL) because of "
        + OpenSsl.unavailabilityCause());
  }
}

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

/**
 * Determines if Netty OpenSSL support is available and applicable based on the configuration
 * in the given TransportOptions instance.
 *
 * @param options
 *           The configuration of the Transport being created.
 *
 * @return true if OpenSSL support is available and usable given the requested configuration.
 */
public static boolean isOpenSSLPossible(TransportOptions options) {
  boolean result = false;
  if (options.isUseOpenSSL()) {
    if (!OpenSsl.isAvailable()) {
      LOG.debug("OpenSSL could not be enabled because a suitable implementation could not be found.", OpenSsl.unavailabilityCause());
    } else if (options.getSslContextOverride() != null) {
      LOG.debug("OpenSSL could not be enabled due to user SSLContext being supplied.");
    } else if (!OpenSsl.supportsKeyManagerFactory()) {
      LOG.debug("OpenSSL could not be enabled because the version provided does not allow a KeyManagerFactory to be used.");
    } else if (options.isVerifyHost() && !OpenSsl.supportsHostnameValidation()) {
      LOG.debug("OpenSSL could not be enabled due to verifyHost being enabled but not supported by the provided OpenSSL version.");
    } else if (options.getKeyAlias() != null) {
      LOG.debug("OpenSSL could not be enabled because a keyAlias is set and that feature is not supported for OpenSSL.");
    } else {
      LOG.debug("OpenSSL Enabled: Version {} of OpenSSL will be used", OpenSsl.versionString());
      result = true;
    }
  }
  return result;
}

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

/**
 * Determines if Netty OpenSSL support is available and applicable based on the configuration
 * in the given TransportOptions instance.
 *
 * @param options
 *           The configuration of the Transport being created.
 *
 * @return true if OpenSSL support is available and usable given the requested configuration.
 */
public static boolean isOpenSSLPossible(TransportOptions options) {
  boolean result = false;
  if (options.isUseOpenSSL()) {
    if (!OpenSsl.isAvailable()) {
      LOG.debug("OpenSSL could not be enabled because a suitable implementation could not be found.", OpenSsl.unavailabilityCause());
    } else if (options.getSslContextOverride() != null) {
      LOG.debug("OpenSSL could not be enabled due to user SSLContext being supplied.");
    } else if (!OpenSsl.supportsKeyManagerFactory()) {
      LOG.debug("OpenSSL could not be enabled because the version provided does not allow a KeyManagerFactory to be used.");
    } else if (options.isVerifyHost() && !OpenSsl.supportsHostnameValidation()) {
      LOG.debug("OpenSSL could not be enabled due to verifyHost being enabled but not supported by the provided OpenSSL version.");
    } else if (options.getKeyAlias() != null) {
      LOG.debug("OpenSSL could not be enabled because a keyAlias is set and that feature is not supported for OpenSSL.");
    } else {
      LOG.debug("OpenSSL Enabled: Version {} of OpenSSL will be used", OpenSsl.versionString());
      result = true;
    }
  }
  return result;
}

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

builder.field("ssl_openssl_non_available_cause", openSslUnavailCause==null?"":openSslUnavailCause.toString());
builder.field("ssl_openssl_supports_key_manager_factory", OpenSsl.supportsKeyManagerFactory());
builder.field("ssl_openssl_supports_hostname_validation", OpenSsl.supportsHostnameValidation());
builder.field("ssl_provider_http", sgks.getHTTPProviderName());
builder.field("ssl_provider_transport_server", sgks.getTransportServerProviderName());

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

final boolean supportsHostnameValidation = OpenSsl.supportsHostnameValidation();
final boolean useOpenSsl = isOpenSslAvailable && supportsKeyManagerFactory &&
    (supportsHostnameValidation || !config.isHostnameVerificationRequired());

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

final boolean supportsHostnameValidation = OpenSsl.supportsHostnameValidation();
final boolean useOpenSsl = isOpenSslAvailable && supportsKeyManagerFactory &&
    (supportsHostnameValidation || !config.isHostnameVerificationRequired());

相关文章