< prev index next >

test/java/security/SignedObject/Chain.java

Print this page
rev 12543 : 8181048: Refactor existing providers to refer to the same constants for default values for key length
Reviewed-by: mullan, ahgross

*** 30,40 **** import java.security.PublicKey; import java.util.Arrays; /* * @test ! * @bug 8050374 * @summary Verify a chain of signed objects */ public class Chain { static enum KeyAlg { --- 30,40 ---- import java.security.PublicKey; import java.util.Arrays; /* * @test ! * @bug 8050374 8181048 * @summary Verify a chain of signed objects */ public class Chain { static enum KeyAlg {
*** 95,120 **** static class Test { final Provider provider; final KeyAlg keyAlg; final SigAlg sigAlg; ! Test(SigAlg sigAlg, KeyAlg keyAlg, Provider privider) { ! this.provider = privider; this.keyAlg = keyAlg; this.sigAlg = sigAlg; } } private static final Test[] tests = { ! new Test(SigAlg.SHA1withDSA, KeyAlg.DSA, Provider.Default), new Test(SigAlg.MD2withRSA, KeyAlg.RSA, Provider.Default), new Test(SigAlg.MD5withRSA, KeyAlg.RSA, Provider.Default), new Test(SigAlg.SHA1withRSA, KeyAlg.RSA, Provider.Default), ! new Test(SigAlg.SHA1withDSA, KeyAlg.DSA, Provider.Sun), ! new Test(SigAlg.SHA224withDSA, KeyAlg.DSA, Provider.Sun), ! new Test(SigAlg.SHA256withDSA, KeyAlg.DSA, Provider.Sun), }; private static final String str = "to-be-signed"; private static final int N = 3; --- 95,126 ---- static class Test { final Provider provider; final KeyAlg keyAlg; final SigAlg sigAlg; + final int keySize; ! Test(SigAlg sigAlg, KeyAlg keyAlg, Provider provider) { ! this(sigAlg, keyAlg, provider, -1); ! } ! ! Test(SigAlg sigAlg, KeyAlg keyAlg, Provider provider, int keySize) { ! this.provider = provider; this.keyAlg = keyAlg; this.sigAlg = sigAlg; + this.keySize = keySize; } } private static final Test[] tests = { ! new Test(SigAlg.SHA1withDSA, KeyAlg.DSA, Provider.Default, 1024), new Test(SigAlg.MD2withRSA, KeyAlg.RSA, Provider.Default), new Test(SigAlg.MD5withRSA, KeyAlg.RSA, Provider.Default), new Test(SigAlg.SHA1withRSA, KeyAlg.RSA, Provider.Default), ! new Test(SigAlg.SHA1withDSA, KeyAlg.DSA, Provider.Sun, 1024), ! new Test(SigAlg.SHA224withDSA, KeyAlg.DSA, Provider.Sun, 2048), ! new Test(SigAlg.SHA256withDSA, KeyAlg.DSA, Provider.Sun, 2048), }; private static final String str = "to-be-signed"; private static final int N = 3;
*** 137,146 **** --- 143,155 ---- PublicKey[] pubKeys = new PublicKey[N]; PublicKey[] anotherPubKeys = new PublicKey[N]; KeyPairGenerator kpg = KeyPairGenerator.getInstance( test.keyAlg.name); for (int j=0; j < N; j++) { + if (test.keySize != -1) { + kpg.initialize(test.keySize); + } KeyPair kp = kpg.genKeyPair(); KeyPair anotherKp = kpg.genKeyPair(); privKeys[j] = kp.getPrivate(); pubKeys[j] = kp.getPublic(); anotherPubKeys[j] = anotherKp.getPublic();
< prev index next >