10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @library ..
27 * @bug 4891312 8074460
28 * @summary verify that modPow() not broken by the special case for 65537 (use -Dseed=X to set PRNG seed)
29 * @author Andreas Sterbenz
30 */
31
32 import java.math.BigInteger;
33
34 import java.security.*;
35 import java.security.spec.*;
36
37 public class ModPow65537 {
38
39 public static void main(String[] args) throws Exception {
40 // SunRsaSign uses BigInteger internally
41 KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", "SunRsaSign");
42 kpg.initialize(new RSAKeyGenParameterSpec(512, BigInteger.valueOf(65537)));
43 KeyPair kp = kpg.generateKeyPair();
44 testSigning(kp);
45
46 kpg.initialize(new RSAKeyGenParameterSpec(512, BigInteger.valueOf(65539)));
47 kp = kpg.generateKeyPair();
48 testSigning(kp);
49
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @library ..
27 * @bug 4891312 8074460
28 * @summary verify that modPow() not broken by the special case for 65537 (use -Dseed=X to set PRNG seed)
29 * @author Andreas Sterbenz
30 * @key randomness
31 */
32
33 import java.math.BigInteger;
34
35 import java.security.*;
36 import java.security.spec.*;
37
38 public class ModPow65537 {
39
40 public static void main(String[] args) throws Exception {
41 // SunRsaSign uses BigInteger internally
42 KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", "SunRsaSign");
43 kpg.initialize(new RSAKeyGenParameterSpec(512, BigInteger.valueOf(65537)));
44 KeyPair kp = kpg.generateKeyPair();
45 testSigning(kp);
46
47 kpg.initialize(new RSAKeyGenParameterSpec(512, BigInteger.valueOf(65539)));
48 kp = kpg.generateKeyPair();
49 testSigning(kp);
50
|