8169229: RSAClientKeyExchange debug info is incorrect
authorwetmore
Tue, 08 Nov 2016 16:54:28 -0800
changeset 41961 12edcce2cb80
parent 41960 916bb3d29d7b
child 41962 a52f798399ca
child 42678 9873beb737e9
8169229: RSAClientKeyExchange debug info is incorrect Reviewed-by: xuelei
jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java
--- a/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java	Tue Nov 08 15:55:11 2016 -0800
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java	Tue Nov 08 16:54:28 2016 -0800
@@ -257,7 +257,13 @@
 
     @Override
     void print(PrintStream s) throws IOException {
-        s.println("*** ClientKeyExchange, RSA PreMasterSecret, " +
-                                                        protocolVersion);
+        String version = "version not available/extractable";
+
+        byte[] ba = preMaster.getEncoded();
+        if (ba != null && ba.length >= 2) {
+            version = ProtocolVersion.valueOf(ba[0], ba[1]).name;
+        }
+
+        s.println("*** ClientKeyExchange, RSA PreMasterSecret, " + version);
     }
 }