Use DiffieHellman rather than the DH alias JDK-8145252-TLS13-branch
authorxuelei
Thu, 24 May 2018 11:34:31 -0700
branchJDK-8145252-TLS13-branch
changeset 56605 afb358e14f29
parent 56603 f103e0c2be1e
child 56606 0cabcf9cb31b
Use DiffieHellman rather than the DH alias
src/java.base/share/classes/sun/security/ssl/CookieExtension.java
src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java
src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java
--- a/src/java.base/share/classes/sun/security/ssl/CookieExtension.java	Thu May 24 09:21:01 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/CookieExtension.java	Thu May 24 11:34:31 2018 -0700
@@ -63,10 +63,6 @@
     static class CookieSpec implements SSLExtensionSpec {
         final byte[] cookie;
 
-        CookieSpec(byte[] cookie) {
-            this.cookie = cookie;
-        }
-
         private CookieSpec(ByteBuffer m) throws IOException {
             // opaque cookie<1..2^16-1>;
             if (m.remaining() < 3) {
--- a/src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java	Thu May 24 09:21:01 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/DHClientKeyExchange.java	Thu May 24 11:34:31 2018 -0700
@@ -278,7 +278,7 @@
                 DHPublicKeySpec spec = new DHPublicKeySpec(
                         new BigInteger(1, ckem.y),
                         params.getP(), params.getG());
-                KeyFactory kf = JsseJce.getKeyFactory("DH");
+                KeyFactory kf = JsseJce.getKeyFactory("DiffieHellman");
                 DHPublicKey peerPublicKey =
                         (DHPublicKey)kf.generatePublic(spec);
 
--- a/src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java	Thu May 24 09:21:01 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/DHKeyExchange.java	Thu May 24 11:34:31 2018 -0700
@@ -103,7 +103,8 @@
 
         DHEPossession(NamedGroup namedGroup, SecureRandom random) {
             try {
-                KeyPairGenerator kpg = JsseJce.getKeyPairGenerator("DH");
+                KeyPairGenerator kpg =
+                        JsseJce.getKeyPairGenerator("DiffieHellman");
                 DHParameterSpec params =
                         (DHParameterSpec)namedGroup.getParameterSpec();
                 kpg.initialize(params, random);
@@ -151,7 +152,8 @@
 
         DHEPossession(DHECredentials credentials, SecureRandom random) {
             try {
-                KeyPairGenerator kpg = JsseJce.getKeyPairGenerator("DH");
+                KeyPairGenerator kpg =
+                        JsseJce.getKeyPairGenerator("DiffieHellman");
                 kpg.initialize(credentials.popPublicKey.getParams(), random);
                 KeyPair kp = generateDHKeyPair(kpg);
                 if (kp == null) {
@@ -457,7 +459,7 @@
             private SecretKey t12DeriveKey(String algorithm,
                     AlgorithmParameterSpec params) throws IOException {
                 try {
-                    KeyAgreement ka = JsseJce.getKeyAgreement("DH");
+                    KeyAgreement ka = JsseJce.getKeyAgreement("DiffieHellman");
                     ka.init(localPrivateKey);
                     ka.doPhase(peerPublicKey, true);
                     SecretKey preMasterSecret =
@@ -477,7 +479,7 @@
             private SecretKey t13DeriveKey(String algorithm,
                     AlgorithmParameterSpec params) throws IOException {
                 try {
-                    KeyAgreement ka = JsseJce.getKeyAgreement("DH");
+                    KeyAgreement ka = JsseJce.getKeyAgreement("DiffieHellman");
                     ka.init(localPrivateKey);
                     ka.doPhase(peerPublicKey, true);
                     SecretKey sharedSecret =