25 import java.security.InvalidKeyException;
26 import java.security.NoSuchAlgorithmException;
27 import java.security.NoSuchProviderException;
28 import java.security.spec.AlgorithmParameterSpec;
29 import java.util.Random;
30 import javax.crypto.BadPaddingException;
31 import javax.crypto.Cipher;
32 import javax.crypto.IllegalBlockSizeException;
33 import javax.crypto.KeyGenerator;
34 import javax.crypto.NoSuchPaddingException;
35 import javax.crypto.SecretKey;
36 import javax.crypto.ShortBufferException;
37 import javax.crypto.spec.IvParameterSpec;
38
39 /**
40 * @test
41 * @bug 8043836
42 * @summary Test AES ciphers with different modes and padding schemes (ECB mode
43 * doesn't use IV). The test tries 3 different read methods of
44 * CipherInputStream.
45 */
46 public class Padding {
47
48 private static final String ALGORITHM = "AES";
49 private static final String PROVIDER = "SunJCE";
50 private static final String[] MODES = { "ECb", "CbC", "PCBC", "OFB",
51 "OFB150", "cFB", "CFB7", "cFB8", "cFB16", "cFB24", "cFB32",
52 "Cfb40", "cfB48", "cfB56", "cfB64", "cfB72", "cfB80", "cfB88",
53 "cfB96", "cfb104", "cfB112", "cfB120", "OFB8", "OFB16", "OFB24",
54 "OFB32", "OFB40", "OFB48", "OFB56", "OFB64", "OFB72", "OFB80",
55 "OFB88", "OFB96", "OFB104", "OFB112", "OFB120", "GCM" };
56 private static final String PADDING = "PKCS5Padding";
57 private static final int KEY_LENGTH = 128;
58
59 public static void main(String argv[]) throws Exception {
60 Padding test = new Padding();
61 for (String mode : MODES) {
62 test.runTest(ALGORITHM, mode, PADDING);
63 }
64 }
|
25 import java.security.InvalidKeyException;
26 import java.security.NoSuchAlgorithmException;
27 import java.security.NoSuchProviderException;
28 import java.security.spec.AlgorithmParameterSpec;
29 import java.util.Random;
30 import javax.crypto.BadPaddingException;
31 import javax.crypto.Cipher;
32 import javax.crypto.IllegalBlockSizeException;
33 import javax.crypto.KeyGenerator;
34 import javax.crypto.NoSuchPaddingException;
35 import javax.crypto.SecretKey;
36 import javax.crypto.ShortBufferException;
37 import javax.crypto.spec.IvParameterSpec;
38
39 /**
40 * @test
41 * @bug 8043836
42 * @summary Test AES ciphers with different modes and padding schemes (ECB mode
43 * doesn't use IV). The test tries 3 different read methods of
44 * CipherInputStream.
45 * @key randomness
46 */
47 public class Padding {
48
49 private static final String ALGORITHM = "AES";
50 private static final String PROVIDER = "SunJCE";
51 private static final String[] MODES = { "ECb", "CbC", "PCBC", "OFB",
52 "OFB150", "cFB", "CFB7", "cFB8", "cFB16", "cFB24", "cFB32",
53 "Cfb40", "cfB48", "cfB56", "cfB64", "cfB72", "cfB80", "cfB88",
54 "cfB96", "cfb104", "cfB112", "cfB120", "OFB8", "OFB16", "OFB24",
55 "OFB32", "OFB40", "OFB48", "OFB56", "OFB64", "OFB72", "OFB80",
56 "OFB88", "OFB96", "OFB104", "OFB112", "OFB120", "GCM" };
57 private static final String PADDING = "PKCS5Padding";
58 private static final int KEY_LENGTH = 128;
59
60 public static void main(String argv[]) throws Exception {
61 Padding test = new Padding();
62 for (String mode : MODES) {
63 test.runTest(ALGORITHM, mode, PADDING);
64 }
65 }
|