Home / Class/ CipherSuiteConverter Class — netty Architecture

CipherSuiteConverter Class — netty Architecture

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

Entity Profile

Dependency Diagram

graph TD
  943634e0_77f3_02c9_2c51_68b03859df87["CipherSuiteConverter"]
  c64aef25_d52c_985f_a3c2_6997a514046d["CipherSuiteConverter.java"]
  943634e0_77f3_02c9_2c51_68b03859df87 -->|defined in| c64aef25_d52c_985f_a3c2_6997a514046d
  297e1cb1_e921_b3e8_5e9c_2c491ac7706e["clearCache()"]
  943634e0_77f3_02c9_2c51_68b03859df87 -->|method| 297e1cb1_e921_b3e8_5e9c_2c491ac7706e
  6d1c38a2_80fc_970c_7599_42553997ddfa["isJ2OCached()"]
  943634e0_77f3_02c9_2c51_68b03859df87 -->|method| 6d1c38a2_80fc_970c_7599_42553997ddfa
  4e897c95_e12d_b223_2c8e_9452d1bd6af9["isO2JCached()"]
  943634e0_77f3_02c9_2c51_68b03859df87 -->|method| 4e897c95_e12d_b223_2c8e_9452d1bd6af9
  499d1fe5_d79c_8011_25a1_9ceb6d935211["String()"]
  943634e0_77f3_02c9_2c51_68b03859df87 -->|method| 499d1fe5_d79c_8011_25a1_9ceb6d935211
  35ded404_1214_d366_4e04_097fb989768a["cacheFromOpenSsl()"]
  943634e0_77f3_02c9_2c51_68b03859df87 -->|method| 35ded404_1214_d366_4e04_097fb989768a
  a6fae95d_bdc3_895d_0e4b_47df0b36a2c9["convertToCipherStrings()"]
  943634e0_77f3_02c9_2c51_68b03859df87 -->|method| a6fae95d_bdc3_895d_0e4b_47df0b36a2c9
  ab2cb1f7_91d5_0764_a050_d6160174ed23["CipherSuiteConverter()"]
  943634e0_77f3_02c9_2c51_68b03859df87 -->|method| ab2cb1f7_91d5_0764_a050_d6160174ed23

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/ssl/CipherSuiteConverter.java lines 38–516

@UnstableApi
public final class CipherSuiteConverter {

    private static final InternalLogger logger = InternalLoggerFactory.getInstance(CipherSuiteConverter.class);

    /**
     * A_B_WITH_C_D, where:
     *
     * A - TLS or SSL (protocol)
     * B - handshake algorithm (key exchange and authentication algorithms to be precise)
     * C - bulk cipher
     * D - HMAC algorithm
     *
     * This regular expression assumes that:
     *
     * 1) A is always TLS or SSL, and
     * 2) D is always a single word.
     */
    private static final Pattern JAVA_CIPHERSUITE_PATTERN =
            Pattern.compile("^(?:TLS|SSL)_((?:(?!_WITH_).)+)_WITH_(.*)_(.*)$");

    /**
     * A-B-C, where:
     *
     * A - handshake algorithm (key exchange and authentication algorithms to be precise)
     * B - bulk cipher
     * C - HMAC algorithm
     *
     * This regular expression assumes that:
     *
     * 1) A has some deterministic pattern as shown below, and
     * 2) C is always a single word
     */
    private static final Pattern OPENSSL_CIPHERSUITE_PATTERN =
            // Be very careful not to break the indentation while editing.
            Pattern.compile(
                    "^(?:(" + // BEGIN handshake algorithm
                        "(?:(?:EXP-)?" +
                            "(?:" +
                                "(?:DHE|EDH|ECDH|ECDHE|SRP|RSA)-(?:DSS|RSA|ECDSA|PSK)|" +
                                "(?:ADH|AECDH|KRB5|PSK|SRP)" +
                            ')' +
                        ")|" +
                        "EXP" +
                    ")-)?" +  // END handshake algorithm
                    "(.*)-(.*)$");

    private static final Pattern JAVA_AES_CBC_PATTERN = Pattern.compile("^(AES)_([0-9]+)_CBC$");
    private static final Pattern JAVA_AES_PATTERN = Pattern.compile("^(AES)_([0-9]+)_(.*)$");
    private static final Pattern OPENSSL_AES_CBC_PATTERN = Pattern.compile("^(AES)([0-9]+)$");
    private static final Pattern OPENSSL_AES_PATTERN = Pattern.compile("^(AES)([0-9]+)-(.*)$");

    /**
     * Used to store nullable values in a CHM
     */
    private static final class CachedValue {

        private static final CachedValue NULL = new CachedValue(null);

        static CachedValue of(String value) {
            return value != null ? new CachedValue(value) : NULL;
        }

        final String value;
        private CachedValue(String value) {
            this.value = value;
        }
    }

    /**
     * Java-to-OpenSSL cipher suite conversion map
     * Note that the Java cipher suite has the protocol prefix (TLS_, SSL_)
     */
    private static final ConcurrentMap<String, CachedValue> j2o = new ConcurrentHashMap<>();

    /**
     * OpenSSL-to-Java cipher suite conversion map.
     * Note that one OpenSSL cipher suite can be converted to more than one Java cipher suites because
     * a Java cipher suite has the protocol name prefix (TLS_, SSL_)
     */
    private static final ConcurrentMap<String, Map<String, String>> o2j = new ConcurrentHashMap<>();

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free