Home / Class/ Conscrypt Class — netty Architecture

Conscrypt Class — netty Architecture

Architecture documentation for the Conscrypt class in Conscrypt.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  a01d3d17_3442_3f9c_c47b_fd6d0b960e46["Conscrypt"]
  80938576_a11c_eec7_efd1_703e3c04d7dc["Conscrypt.java"]
  a01d3d17_3442_3f9c_c47b_fd6d0b960e46 -->|defined in| 80938576_a11c_eec7_efd1_703e3c04d7dc
  04f0e12b_5f8b_5675_5358_0fd7b5d3f50e["isAvailable()"]
  a01d3d17_3442_3f9c_c47b_fd6d0b960e46 -->|method| 04f0e12b_5f8b_5675_5358_0fd7b5d3f50e
  f9da51bd_9dda_3535_6cdd_4da48cd77c9c["isEngineSupported()"]
  a01d3d17_3442_3f9c_c47b_fd6d0b960e46 -->|method| f9da51bd_9dda_3535_6cdd_4da48cd77c9c
  79e76981_fe69_c5a8_0f8d_05e86b123a89["Conscrypt()"]
  a01d3d17_3442_3f9c_c47b_fd6d0b960e46 -->|method| 79e76981_fe69_c5a8_0f8d_05e86b123a89

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/ssl/Conscrypt.java lines 27–74

final class Conscrypt {
    // This class exists to avoid loading other conscrypt related classes using features only available in JDK8+,
    // because we need to maintain JDK6+ runtime compatibility.
    private static final Method IS_CONSCRYPT_SSLENGINE;

    static {
        Method isConscryptSSLEngine = null;

        // Only works on Java14 and earlier for now
        // See https://github.com/google/conscrypt/issues/838
        if (PlatformDependent.javaVersion() < 15 || PlatformDependent.isAndroid()) {
            try {
                Class<?> providerClass = Class.forName("org.conscrypt.OpenSSLProvider", true,
                        PlatformDependent.getClassLoader(ConscryptAlpnSslEngine.class));
                providerClass.newInstance();

                Class<?> conscryptClass = Class.forName("org.conscrypt.Conscrypt", true,
                        PlatformDependent.getClassLoader(ConscryptAlpnSslEngine.class));
                isConscryptSSLEngine = conscryptClass.getMethod("isConscrypt", SSLEngine.class);
            } catch (Throwable ignore) {
                // ignore
            }
        }
        IS_CONSCRYPT_SSLENGINE = isConscryptSSLEngine;
    }

    /**
     * Indicates whether or not conscrypt is available on the current system.
     */
    static boolean isAvailable() {
        return IS_CONSCRYPT_SSLENGINE != null;
    }

    /**
     * Returns {@code true} if the passed in {@link SSLEngine} is handled by Conscrypt, {@code false} otherwise.
     */
    static boolean isEngineSupported(SSLEngine engine) {
        try {
            return IS_CONSCRYPT_SSLENGINE != null && (Boolean) IS_CONSCRYPT_SSLENGINE.invoke(null, engine);
        } catch (IllegalAccessException ignore) {
            return false;
        } catch (InvocationTargetException ex) {
            throw new RuntimeException(ex);
        }
    }

    private Conscrypt() { }
}

Frequently Asked Questions

What is the Conscrypt class?
Conscrypt is a class in the netty codebase, defined in handler/src/main/java/io/netty/handler/ssl/Conscrypt.java.
Where is Conscrypt defined?
Conscrypt is defined in handler/src/main/java/io/netty/handler/ssl/Conscrypt.java at line 27.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free