|
diff --git a/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java b/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java |
|
|
--- openjdk/jdk/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java |
|
|
+++ openjdk/jdk/src/share/classes/com/sun/crypto/provider/DHKeyPairGenerator.java |
|
|
@@ -1,5 +1,6 @@ |
|
|
/* |
|
|
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
|
|
+ * Copyright (c) 2014 Red Hat Inc. |
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
|
* |
|
|
* This code is free software; you can redistribute it and/or modify it |
|
|
@@ -74,10 +75,10 @@ |
|
|
private static void checkKeySize(int keysize) |
|
|
throws InvalidParameterException { |
|
|
|
|
|
- if ((keysize < 512) || (keysize > 2048) || ((keysize & 0x3F) != 0)) { |
|
|
+ if ((keysize < 512) || (keysize > 4096) || ((keysize & 0x3F) != 0)) { |
|
|
throw new InvalidParameterException( |
|
|
"DH key size must be multiple of 64, and can only range " + |
|
|
- "from 512 to 2048 (inclusive). " + |
|
|
+ "from 512 to 4096 (inclusive). " + |
|
|
"The specific key size " + keysize + " is not supported"); |
|
|
} |
|
|
} |
|
1 |
diff --git a/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java b/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java |
diff --git a/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java b/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java |
2 |
--- openjdk/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java |
--- openjdk/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java |
3 |
+++ openjdk/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java |
+++ openjdk/jdk/src/share/classes/com/sun/crypto/provider/DHParameterGenerator.java |
8 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9 |
* |
* |
10 |
* This code is free software; you can redistribute it and/or modify it |
* This code is free software; you can redistribute it and/or modify it |
11 |
@@ -61,11 +62,11 @@ |
@@ -61,13 +62,13 @@ |
12 |
|
|
13 |
private static void checkKeySize(int keysize) |
private static void checkKeySize(int keysize) |
14 |
throws InvalidParameterException { |
throws InvalidParameterException { |
15 |
- if ((keysize != 2048) && |
- boolean supported = ((keysize == 2048) || (keysize == 3072) || |
16 |
+ if ((keysize != 2048) && (keysize != 4096) && |
+ boolean supported = ((keysize == 2048) || (keysize == 3072) || (keysize == 4096) || |
17 |
((keysize < 512) || (keysize > 1024) || (keysize % 64 != 0))) { |
((keysize >= 512) && (keysize <= 1024) && ((keysize & 0x3F) == 0))); |
18 |
|
|
19 |
|
if (!supported) { |
20 |
throw new InvalidParameterException( |
throw new InvalidParameterException( |
21 |
"DH key size must be multiple of 64 and range " + |
"DH key size must be multiple of 64 and range " + |
22 |
- "from 512 to 1024 (inclusive), or 2048. " + |
- "from 512 to 1024 (inclusive), or 2048, 3072. " + |
23 |
+ "from 512 to 1024 (inclusive), or 2048, or 4096. " + |
+ "from 512 to 1024 (inclusive), or 2048, 3072, 4096. " + |
24 |
"The specific key size " + keysize + " is not supported"); |
"The specific key size " + keysize + " is not supported"); |
25 |
} |
} |
26 |
} |
} |
|
diff --git a/src/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java b/src/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java |
|
|
--- openjdk/jdk/src/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java |
|
|
+++ openjdk/jdk/src/share/classes/sun/security/pkcs11/P11KeyPairGenerator.java |
|
|
@@ -292,11 +292,11 @@ |
|
|
// this restriction is in the spec for DSA |
|
|
// since we currently use DSA parameters for DH as well, |
|
|
// it also applies to DH if no parameters are specified |
|
|
- if ((keySize != 2048) && |
|
|
+ if ((keySize != 2048) && (keySize != 4096) && |
|
|
((keySize > 1024) || ((keySize & 0x3f) != 0))) { |
|
|
throw new InvalidAlgorithmParameterException(algorithm + |
|
|
" key must be multiples of 64 if less than 1024 bits" + |
|
|
- ", or 2048 bits. " + |
|
|
+ ", or 2048 bits, or 4096 bits. " + |
|
|
"The specific key size " + |
|
|
keySize + " is not supported"); |
|
|
} |
|
27 |
diff --git a/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java b/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java |
diff --git a/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java b/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java |
28 |
--- openjdk/jdk/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java |
--- openjdk/jdk/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java |
29 |
+++ openjdk/jdk/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java |
+++ openjdk/jdk/test/com/sun/crypto/provider/KeyAgreement/TestExponentSize.java |
30 |
@@ -1,5 +1,6 @@ |
@@ -1,5 +1,6 @@ |
31 |
/* |
/* |
32 |
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. |
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. |
33 |
+ * Copyright (c) 2014 Red Hat Inc. |
+ * Copyright (c) 2014 Red Hat Inc. |
34 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
35 |
* |
* |
63 |
System.out.println("OK"); |
System.out.println("OK"); |
64 |
} |
} |
65 |
|
|
66 |
|
|