author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 43248 | jdk/test/sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java@5e15de85a1a0 |
child 51460 | 97e361fe3433 |
permissions | -rw-r--r-- |
37361
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
1 |
/* |
43248
5e15de85a1a0
8172527: Rename jdk.crypto.token to jdk.crypto.cryptoki
ascarpino
parents:
42693
diff
changeset
|
2 |
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. |
37361
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
4 |
* |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
8 |
* |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
13 |
* accompanied this code). |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
14 |
* |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
18 |
* |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
21 |
* questions. |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
22 |
*/ |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
23 |
|
40975
680639c9b307
8165689: Fix module dependencies for sun/security/pkcs11/* tests
skovalev
parents:
37884
diff
changeset
|
24 |
/* |
37361
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
25 |
* @test |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
26 |
* @bug 8072452 |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
27 |
* @summary Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
28 |
* @library .. |
43248
5e15de85a1a0
8172527: Rename jdk.crypto.token to jdk.crypto.cryptoki
ascarpino
parents:
42693
diff
changeset
|
29 |
* @modules jdk.crypto.cryptoki |
37361
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
30 |
* @run main/othervm SupportedDHKeys |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
31 |
* @run main/othervm SupportedDHKeys sm |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
32 |
*/ |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
33 |
|
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
34 |
import java.math.BigInteger; |
40975
680639c9b307
8165689: Fix module dependencies for sun/security/pkcs11/* tests
skovalev
parents:
37884
diff
changeset
|
35 |
import java.security.KeyPair; |
680639c9b307
8165689: Fix module dependencies for sun/security/pkcs11/* tests
skovalev
parents:
37884
diff
changeset
|
36 |
import java.security.KeyPairGenerator; |
680639c9b307
8165689: Fix module dependencies for sun/security/pkcs11/* tests
skovalev
parents:
37884
diff
changeset
|
37 |
import java.security.Provider; |
680639c9b307
8165689: Fix module dependencies for sun/security/pkcs11/* tests
skovalev
parents:
37884
diff
changeset
|
38 |
import javax.crypto.interfaces.DHPrivateKey; |
680639c9b307
8165689: Fix module dependencies for sun/security/pkcs11/* tests
skovalev
parents:
37884
diff
changeset
|
39 |
import javax.crypto.interfaces.DHPublicKey; |
680639c9b307
8165689: Fix module dependencies for sun/security/pkcs11/* tests
skovalev
parents:
37884
diff
changeset
|
40 |
import javax.crypto.spec.DHParameterSpec; |
37361
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
41 |
|
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
42 |
public class SupportedDHKeys extends PKCS11Test { |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
43 |
|
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
44 |
/* |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
45 |
* Sizes and values for various lengths. |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
46 |
*/ |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
47 |
private enum SupportedKeySize { |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
48 |
dhp512(512), dhp768(768), dhp832(832), |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
49 |
dhp1024(1024), dhp1536(1536), dhp2048(2048); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
50 |
|
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
51 |
// the underlying pkcs11 may not support the following sizes yet |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
52 |
// |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
53 |
// dhp3072(3072), dhp4096(4096), dhp6144(6144), |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
54 |
// dhp8192(8192); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
55 |
|
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
56 |
final int primeSize; |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
57 |
|
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
58 |
SupportedKeySize(int primeSize) { |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
59 |
this.primeSize = primeSize; |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
60 |
} |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
61 |
} |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
62 |
|
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
63 |
@Override |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
64 |
public void main(Provider provider) throws Exception { |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
65 |
if (provider.getService("KeyPairGenerator", "DiffieHellman") == null) { |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
66 |
System.out.println("No support of DH KeyPairGenerator, skipping"); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
67 |
return; |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
68 |
} |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
69 |
|
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
70 |
for (SupportedKeySize keySize : SupportedKeySize.values()) { |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
71 |
System.out.println("Checking " + keySize.primeSize + " ..."); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
72 |
KeyPairGenerator kpg = |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
73 |
KeyPairGenerator.getInstance("DiffieHellman", provider); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
74 |
kpg.initialize(keySize.primeSize); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
75 |
KeyPair kp = kpg.generateKeyPair(); |
37875
3d1383fb1d51
8154344: sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java fails on solaris
xuelei
parents:
37361
diff
changeset
|
76 |
checkKeyPair(kp, keySize.primeSize, provider); |
37361
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
77 |
|
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
78 |
DHPublicKey publicKey = (DHPublicKey)kp.getPublic(); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
79 |
BigInteger p = publicKey.getParams().getP(); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
80 |
BigInteger g = publicKey.getParams().getG(); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
81 |
kpg.initialize(new DHParameterSpec(p, g)); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
82 |
kp = kpg.generateKeyPair(); |
37875
3d1383fb1d51
8154344: sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java fails on solaris
xuelei
parents:
37361
diff
changeset
|
83 |
checkKeyPair(kp, keySize.primeSize, provider); |
37361
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
84 |
} |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
85 |
} |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
86 |
|
37875
3d1383fb1d51
8154344: sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java fails on solaris
xuelei
parents:
37361
diff
changeset
|
87 |
private static void checkKeyPair(KeyPair kp, int pSize, |
3d1383fb1d51
8154344: sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java fails on solaris
xuelei
parents:
37361
diff
changeset
|
88 |
Provider provider) throws Exception { |
37361
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
89 |
|
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
90 |
DHPrivateKey privateKey = (DHPrivateKey)kp.getPrivate(); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
91 |
BigInteger p = privateKey.getParams().getP(); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
92 |
if (p.bitLength() != pSize) { |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
93 |
throw new Exception( |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
94 |
"Invalid modulus size: " + p.bitLength() + "/" + pSize); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
95 |
} |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
96 |
|
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
97 |
// System.out.println("P(" + pSize + "): " + p.toString()); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
98 |
if (!p.isProbablePrime(128)) { |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
99 |
throw new Exception("Good luck, the modulus is composite!"); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
100 |
} |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
101 |
|
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
102 |
DHPublicKey publicKey = (DHPublicKey)kp.getPublic(); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
103 |
p = publicKey.getParams().getP(); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
104 |
if (p.bitLength() != pSize) { |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
105 |
throw new Exception( |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
106 |
"Invalid modulus size: " + p.bitLength() + "/" + pSize); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
107 |
} |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
108 |
|
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
109 |
BigInteger leftOpen = BigInteger.ONE; |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
110 |
BigInteger rightOpen = p.subtract(BigInteger.ONE); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
111 |
|
37875
3d1383fb1d51
8154344: sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java fails on solaris
xuelei
parents:
37361
diff
changeset
|
112 |
// ignore the private key range checking on Solaris at present |
37884
7f404dcfb3dc
8156716: Incorrect condition in test SupportedDHKeys.java
xuelei
parents:
37875
diff
changeset
|
113 |
if (!provider.getName().equals("SunPKCS11-Solaris")) { |
37875
3d1383fb1d51
8154344: sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java fails on solaris
xuelei
parents:
37361
diff
changeset
|
114 |
BigInteger x = privateKey.getX(); |
3d1383fb1d51
8154344: sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java fails on solaris
xuelei
parents:
37361
diff
changeset
|
115 |
if ((x.compareTo(leftOpen) <= 0) || |
3d1383fb1d51
8154344: sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java fails on solaris
xuelei
parents:
37361
diff
changeset
|
116 |
(x.compareTo(rightOpen) >= 0)) { |
3d1383fb1d51
8154344: sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java fails on solaris
xuelei
parents:
37361
diff
changeset
|
117 |
throw new Exception( |
3d1383fb1d51
8154344: sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java fails on solaris
xuelei
parents:
37361
diff
changeset
|
118 |
"X outside range [2, p - 2]: x: " + x + " p: " + p); |
3d1383fb1d51
8154344: sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java fails on solaris
xuelei
parents:
37361
diff
changeset
|
119 |
} |
37361
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
120 |
} |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
121 |
|
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
122 |
BigInteger y = publicKey.getY(); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
123 |
if ((y.compareTo(leftOpen) <= 0) || |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
124 |
(y.compareTo(rightOpen) >= 0)) { |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
125 |
throw new Exception( |
37875
3d1383fb1d51
8154344: sun/security/pkcs11/KeyAgreement/SupportedDHKeys.java fails on solaris
xuelei
parents:
37361
diff
changeset
|
126 |
"Y outside range [2, p - 2]: y: " + y + " p: " + p); |
37361
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
127 |
} |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
128 |
} |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
129 |
|
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
130 |
public static void main(String[] args) throws Exception { |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
131 |
main(new SupportedDHKeys(), args); |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
132 |
} |
a790f7bc3878
8072452: Support DHE sizes up to 8192-bits and DSA sizes up to 3072-bits
xuelei
parents:
diff
changeset
|
133 |
} |