Class CipherSuiteConverter
java.lang.Object
io.netty.handler.ssl.CipherSuiteConverter
Converts a Java cipher suite string to an OpenSSL cipher suite string and vice versa.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classUsed to store nullable values in a CHM -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ConcurrentMap<String, CipherSuiteConverter.CachedValue> Java-to-OpenSSL cipher suite conversion map Note that the Java cipher suite has the protocol prefix (TLS_, SSL_)private static final Patternprivate static final Patternprivate static final PatternA_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 InternalLoggerprivate static final ConcurrentMap<String, Map<String, String>> OpenSSL-to-Java cipher suite conversion map.private static final Patternprivate static final Patternprivate static final PatternA-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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static StringcacheFromJava(String javaCipherSuite, boolean boringSSL) cacheFromOpenSsl(String openSslCipherSuite) (package private) static voidClears the cache for testing purpose.(package private) static voidconvertToCipherStrings(Iterable<String> cipherSuites, StringBuilder cipherBuilder, StringBuilder cipherTLSv13Builder, boolean boringSSL) Convert the given ciphers if needed to OpenSSL format and append them to the correctStringBuilderdepending on if its a TLSv1.3 cipher or not.(package private) static booleanisJ2OCached(String key, String value) Tests if the specified key-value pair has been cached in Java-to-OpenSSL cache.(package private) static booleanisO2JCached(String key, String protocol, String value) Tests if the specified key-value pair has been cached in OpenSSL-to-Java cache.static StringConvert from OpenSSL cipher suite name convention to java cipher suite name convention.private static StringtoJavaBulkCipher(String bulkCipher, boolean export) private static StringtoJavaHandshakeAlgo(String handshakeAlgo, boolean export) private static StringtoJavaHmacAlgo(String hmacAlgo) (package private) static StringtoJavaUncached(String openSslCipherSuite) private static StringtoJavaUncached0(String openSslCipherSuite, boolean checkTls13) static StringConverts the specified Java cipher suite to its corresponding OpenSSL cipher suite name.private static StringtoOpenSslBulkCipher(String bulkCipher) private static StringtoOpenSslHandshakeAlgo(String handshakeAlgo) private static StringtoOpenSslHmacAlgo(String hmacAlgo) (package private) static StringtoOpenSslUncached(String javaCipherSuite, boolean boringSSL)
-
Field Details
-
logger
-
JAVA_CIPHERSUITE_PATTERN
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. -
OPENSSL_CIPHERSUITE_PATTERN
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 -
JAVA_AES_CBC_PATTERN
-
JAVA_AES_PATTERN
-
OPENSSL_AES_CBC_PATTERN
-
OPENSSL_AES_PATTERN
-
j2o
Java-to-OpenSSL cipher suite conversion map Note that the Java cipher suite has the protocol prefix (TLS_, SSL_) -
o2j
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_) -
j2oTls13
-
o2jTls13
-
-
Constructor Details
-
CipherSuiteConverter
private CipherSuiteConverter()
-
-
Method Details
-
clearCache
static void clearCache()Clears the cache for testing purpose. -
isJ2OCached
-
isO2JCached
-
toOpenSsl
-
cacheFromJava
-
toOpenSslUncached
-
toOpenSslHandshakeAlgo
-
toOpenSslBulkCipher
-
toOpenSslHmacAlgo
-
toJava
Convert from OpenSSL cipher suite name convention to java cipher suite name convention.- Parameters:
openSslCipherSuite- An OpenSSL cipher suite name.protocol- The cryptographic protocol (i.e. SSL, TLS, ...).- Returns:
- The translated cipher suite name according to java conventions (or null if translation was not possible).
-
cacheFromOpenSsl
-
toJavaUncached
-
toJavaUncached0
-
toJavaHandshakeAlgo
-
toJavaBulkCipher
-
toJavaHmacAlgo
-
convertToCipherStrings
static void convertToCipherStrings(Iterable<String> cipherSuites, StringBuilder cipherBuilder, StringBuilder cipherTLSv13Builder, boolean boringSSL) Convert the given ciphers if needed to OpenSSL format and append them to the correctStringBuilderdepending on if its a TLSv1.3 cipher or not. If this methods returns without throwing an exception its guaranteed that at least one of theStringBuilders contain some ciphers that can be used to configure OpenSSL.
-