Update on SSLKeyExchange.java and more JDK-8145252-TLS13-branch
authorxuelei
Thu, 21 Jun 2018 21:14:08 -0700
branchJDK-8145252-TLS13-branch
changeset 56801 76025c6c6e29
parent 56800 85305a50b1b4
child 56802 a48cca98dea6
Update on SSLKeyExchange.java and more
src/java.base/share/classes/sun/security/ssl/RSAServerKeyExchange.java
src/java.base/share/classes/sun/security/ssl/SSLKeyExchange.java
src/java.base/share/classes/sun/security/ssl/ServerKeyExchange.java
src/java.base/share/classes/sun/security/ssl/X509Authentication.java
--- a/src/java.base/share/classes/sun/security/ssl/RSAServerKeyExchange.java	Thu Jun 21 10:15:41 2018 +0800
+++ b/src/java.base/share/classes/sun/security/ssl/RSAServerKeyExchange.java	Thu Jun 21 21:14:08 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -216,9 +216,6 @@
      */
     private static final
             class RSAServerKeyExchangeProducer implements HandshakeProducer {
-        static final RSAServerKeyExchangeProducer INSTANCE =
-                new RSAServerKeyExchangeProducer();
-
         // Prevent instantiation of this class.
         private RSAServerKeyExchangeProducer() {
             // blank
@@ -306,7 +303,7 @@
             //
             // validate
             //
-            // check constraints of EC PublicKey
+            // check constraints of RSA PublicKey
             RSAPublicKey publicKey;
             try {
                 KeyFactory kf = JsseJce.getKeyFactory("RSA");
--- a/src/java.base/share/classes/sun/security/ssl/SSLKeyExchange.java	Thu Jun 21 10:15:41 2018 +0800
+++ b/src/java.base/share/classes/sun/security/ssl/SSLKeyExchange.java	Thu Jun 21 21:14:08 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,8 @@
 import sun.security.ssl.SupportedGroupsExtension.SupportedGroups;
 import sun.security.ssl.X509Authentication.X509Possession;
 
-final class SSLKeyExchange implements SSLKeyAgreement {
+final class SSLKeyExchange implements SSLKeyAgreementGenerator,
+        SSLHandshakeBinding {
     private final SSLAuthentication authentication;
     private final SSLKeyAgreement keyAgreement;
 
@@ -104,14 +105,6 @@
     }
 
     @Override
-    public SSLPossession createPossession(HandshakeContext handshakeContext) {
-        // Please call createPossessions() so that the SSLAuthentication
-        // is counted.
-        throw new UnsupportedOperationException(
-                "SSLKeyExchange.createPossessions() should be used instead");
-    }
-
-    @Override
     public SSLKeyDerivation createKeyDerivation(
             HandshakeContext handshakeContext) throws IOException {
         return keyAgreement.createKeyDerivation(handshakeContext);
--- a/src/java.base/share/classes/sun/security/ssl/ServerKeyExchange.java	Thu Jun 21 10:15:41 2018 +0800
+++ b/src/java.base/share/classes/sun/security/ssl/ServerKeyExchange.java	Thu Jun 21 21:14:08 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -86,7 +86,7 @@
         @Override
         public void consume(ConnectionContext context,
                 ByteBuffer message) throws IOException {
-            // The producing happens in client side only.
+            // The consuming happens in client side only.
             ClientHandshakeContext chc = (ClientHandshakeContext)context;
 
             // clean up this consumer
@@ -104,7 +104,7 @@
                 }
             }
 
-            // not consumer defined.
+            // no consumer defined.
             chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE,
                         "Unexpected ServerKeyExchange handshake message.");
         }
--- a/src/java.base/share/classes/sun/security/ssl/X509Authentication.java	Thu Jun 21 10:15:41 2018 +0800
+++ b/src/java.base/share/classes/sun/security/ssl/X509Authentication.java	Thu Jun 21 21:14:08 2018 -0700
@@ -171,8 +171,8 @@
             X509Certificate[] clientCerts = km.getCertificateChain(clientAlias);
             if ((clientCerts == null) || (clientCerts.length == 0)) {
                 if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
-                    SSLLogger.finest(
-                            clientAlias + " is not a certificate entry");
+                    SSLLogger.finest(clientAlias +
+                        " is a private key entry with no cert chain stored");
                 }
                 return null;
             }