src/java.base/share/classes/sun/security/ssl/DHServerKeyExchange.java
changeset 53734 cb1642ccc732
parent 53064 103ed9569fc8
child 54417 f87041131515
equal deleted inserted replaced
53733:b5d45c2fe8a0 53734:cb1642ccc732
     1 /*
     1 /*
     2  * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   418         private static Signature getSignature(String keyAlgorithm,
   418         private static Signature getSignature(String keyAlgorithm,
   419                 Key key) throws NoSuchAlgorithmException, InvalidKeyException {
   419                 Key key) throws NoSuchAlgorithmException, InvalidKeyException {
   420             Signature signer = null;
   420             Signature signer = null;
   421             switch (keyAlgorithm) {
   421             switch (keyAlgorithm) {
   422                 case "DSA":
   422                 case "DSA":
   423                     signer = JsseJce.getSignature(JsseJce.SIGNATURE_DSA);
   423                     signer = Signature.getInstance(JsseJce.SIGNATURE_DSA);
   424                     break;
   424                     break;
   425                 case "RSA":
   425                 case "RSA":
   426                     signer = RSASignature.getInstance();
   426                     signer = RSASignature.getInstance();
   427                     break;
   427                     break;
   428                 default:
   428                 default:
   522             // validate
   522             // validate
   523             //
   523             //
   524             // check constraints of EC PublicKey
   524             // check constraints of EC PublicKey
   525             DHPublicKey publicKey;
   525             DHPublicKey publicKey;
   526             try {
   526             try {
   527                 KeyFactory kf = JsseJce.getKeyFactory("DiffieHellman");
   527                 KeyFactory kf = KeyFactory.getInstance("DiffieHellman");
   528                 DHPublicKeySpec spec = new DHPublicKeySpec(
   528                 DHPublicKeySpec spec = new DHPublicKeySpec(
   529                         new BigInteger(1, skem.y),
   529                         new BigInteger(1, skem.y),
   530                         new BigInteger(1, skem.p),
   530                         new BigInteger(1, skem.p),
   531                         new BigInteger(1, skem.g));
   531                         new BigInteger(1, skem.g));
   532                 publicKey = (DHPublicKey)kf.generatePublic(spec);
   532                 publicKey = (DHPublicKey)kf.generatePublic(spec);