SignatureAlgorithmConverter Class — netty Architecture
Architecture documentation for the SignatureAlgorithmConverter class in SignatureAlgorithmConverter.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD e4820084_7d1b_2721_63ce_f22384be66c9["SignatureAlgorithmConverter"] 3759d309_a3a8_a206_940c_2bbb2539954c["SignatureAlgorithmConverter.java"] e4820084_7d1b_2721_63ce_f22384be66c9 -->|defined in| 3759d309_a3a8_a206_940c_2bbb2539954c 0e8ec799_5ca4_90ad_2ed7_22a56a870a60["SignatureAlgorithmConverter()"] e4820084_7d1b_2721_63ce_f22384be66c9 -->|method| 0e8ec799_5ca4_90ad_2ed7_22a56a870a60 1062d547_fd3b_3117_1f1b_9533b9cd36b8["String()"] e4820084_7d1b_2721_63ce_f22384be66c9 -->|method| 1062d547_fd3b_3117_1f1b_9533b9cd36b8
Relationship Graph
Source Code
handler/src/main/java/io/netty/handler/ssl/SignatureAlgorithmConverter.java lines 27–74
final class SignatureAlgorithmConverter {
private SignatureAlgorithmConverter() { }
// OpenSSL has 3 different formats it uses at the moment we will match against all of these.
// For example:
// ecdsa-with-SHA384
// hmacWithSHA384
// dsa_with_SHA224
//
// For more details see https://github.com/openssl/openssl/blob/OpenSSL_1_0_2p/crypto/objects/obj_dat.h
//
// BoringSSL uses a different format:
// https://github.com/google/boringssl/blob/8525ff3/ssl/ssl_privkey.cc#L436
//
private static final Pattern PATTERN = Pattern.compile(
// group 1 - 2
"(?:(^[a-zA-Z].+)With(.+)Encryption$)|" +
// group 3 - 4
"(?:(^[a-zA-Z].+)(?:_with_|-with-|_pkcs1_|_pss_rsae_)(.+$))|" +
// group 5 - 6
"(?:(^[a-zA-Z].+)_(.+$))");
/**
* Converts an OpenSSL algorithm name to a Java algorithm name and return it,
* or return {@code null} if the conversation failed because the format is not known.
*/
static String toJavaName(String opensslName) {
if (opensslName == null) {
return null;
}
Matcher matcher = PATTERN.matcher(opensslName);
if (matcher.matches()) {
String group1 = matcher.group(1);
if (group1 != null) {
return group1.toUpperCase(Locale.ROOT) + "with" + matcher.group(2).toUpperCase(Locale.ROOT);
}
if (matcher.group(3) != null) {
return matcher.group(4).toUpperCase(Locale.ROOT) + "with" + matcher.group(3).toUpperCase(Locale.ROOT);
}
if (matcher.group(5) != null) {
return matcher.group(6).toUpperCase(Locale.ROOT) + "with" + matcher.group(5).toUpperCase(Locale.ROOT);
}
}
return null;
}
}
Source
Frequently Asked Questions
What is the SignatureAlgorithmConverter class?
SignatureAlgorithmConverter is a class in the netty codebase, defined in handler/src/main/java/io/netty/handler/ssl/SignatureAlgorithmConverter.java.
Where is SignatureAlgorithmConverter defined?
SignatureAlgorithmConverter is defined in handler/src/main/java/io/netty/handler/ssl/SignatureAlgorithmConverter.java at line 27.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free