keep expand option and add test coverage

This commit is contained in:
Seán Coffey 2024-11-12 11:42:05 +00:00
parent fb724d3a37
commit a11d50d55c
2 changed files with 23 additions and 3 deletions

View File

@ -79,9 +79,15 @@ public final class SSLLogger {
}
isOn = true;
// log almost everything for the "ssl" value.
// anything else specified with "ssl" in the property value implies
// a subcomponent value is to be logged.
sslOn = property.equals("ssl");
// anything else specified with "ssl" value implies
// a subset of ssl debugging statements. The separator value
// for subset values has never been specified.
// Allow the expand operator here also (e.g. ssl:expand)
sslOn = property.equals("ssl") ||
(property.startsWith("ssl")
&& property.length() == 10
&& !Character.isLetterOrDigit(property.charAt(3))
&& property.endsWith("expand"));
} else {
property = null;
logger = null;
@ -93,6 +99,7 @@ public final class SSLLogger {
private static void help() {
System.err.println();
System.err.println("help print this help message and exit");
System.err.println("expand expand debugging information");
System.err.println();
System.err.println("all turn on all debugging");
System.err.println("ssl turn on ssl debugging");

View File

@ -76,6 +76,19 @@ public class DebugPropertyValues extends SSLSocketTemplate {
"trigger seeding of SecureRandom",
"supported_versions"),
List.of("Plaintext before ENCRYPTION")),
// allow expand option for more verbose output
Arguments.of(List.of("-Djavax.net.debug=ssl,expand"),
List.of("\"logger\".*: \"javax.net.ssl\",",
"\"message\".*: \"Produced ClientHello handshake message:",
"adding as trusted certificates",
"trigger seeding of SecureRandom",
"supported_versions"),
List.of("Plaintext before ENCRYPTION")),
Arguments.of(List.of("-Djavax.net.debug=ssl:record,expand"),
List.of("\"logger\".*: \"javax.net.ssl\",",
"\"message\".*: \"READ: TLSv1.2 application_data"),
List.of("Plaintext before ENCRYPTION",
"\"message\".*: \"Produced ClientHello handshake message:")),
// ssl:plaintext isn't valid. "plaintext" is sub-option for "record"
Arguments.of(List.of("-Djavax.net.debug=ssl:plaintext"),
null,