/** * 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; }
/** * 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; }
Throwable openSslUnavailCause = OpenSsl.unavailabilityCause(); 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());
final boolean supportsKeyManagerFactory = OpenSsl.supportsKeyManagerFactory(); final boolean useOpenSsl = getConfig().isNativeTlsRequired() || (isOpenSslAvailable && supportsKeyManagerFactory);
final boolean supportsKeyManagerFactory = OpenSsl.supportsKeyManagerFactory(); final boolean useOpenSsl = getConfig().isNativeTlsRequired() || (isOpenSslAvailable && supportsKeyManagerFactory);
final boolean supportsKeyManagerFactory = OpenSsl.supportsKeyManagerFactory(); final boolean supportsHostnameValidation = OpenSsl.supportsHostnameValidation(); final boolean useOpenSsl = isOpenSslAvailable && supportsKeyManagerFactory &&
final boolean supportsKeyManagerFactory = OpenSsl.supportsKeyManagerFactory(); final boolean supportsHostnameValidation = OpenSsl.supportsHostnameValidation(); final boolean useOpenSsl = isOpenSslAvailable && supportsKeyManagerFactory &&