< prev index next >

test/com/sun/crypto/provider/Cipher/AES/CICO.java

Print this page




  27 import java.security.InvalidAlgorithmParameterException;
  28 import java.security.InvalidKeyException;
  29 import java.security.NoSuchAlgorithmException;
  30 import java.security.NoSuchProviderException;
  31 import java.security.spec.AlgorithmParameterSpec;
  32 import java.util.Random;
  33 import javax.crypto.Cipher;
  34 import javax.crypto.CipherInputStream;
  35 import javax.crypto.CipherOutputStream;
  36 import javax.crypto.KeyGenerator;
  37 import javax.crypto.NoSuchPaddingException;
  38 import javax.crypto.SecretKey;
  39 import javax.crypto.spec.IvParameterSpec;
  40 
  41 /**
  42  * @test
  43  * @bug 8043836
  44  * @summary Test AES ciphers with different modes and padding schemes (ECB mode
  45  *          doesn't use IV). The test tries 3 different read methods of
  46  *          CipherInputStream.

  47  */
  48 public class CICO {
  49     private static final String ALGORITHM = "aEs";
  50     private static final String[] MODES = { "PCBC", "ECb", "cbC", "cFB",
  51         "cFB24", "cFB32", "Cfb40", "CFB72", "OfB", "OfB20", "OfB48",
  52         "OfB56", "OFB64", "OFB112", "CFB112", "pCbC" };
  53     private static final String[] PADDING = { "noPadding", "pkcs5padding" };
  54     private static final String PROVIDER = "SunJCE";
  55     private static final int NREADS = 3;
  56     private static final int KEY_LENGTH = 128;
  57 
  58     private final byte[] plainText = new byte[1600000];
  59 
  60 
  61     public static void main(String argv[]) throws Exception {
  62         CICO test = new CICO();
  63         for (String mode : MODES) {
  64             for (String pad : PADDING) {
  65                 for (int m = 0; m < NREADS; m++) {
  66                     test.runTest(ALGORITHM, mode, pad, m);




  27 import java.security.InvalidAlgorithmParameterException;
  28 import java.security.InvalidKeyException;
  29 import java.security.NoSuchAlgorithmException;
  30 import java.security.NoSuchProviderException;
  31 import java.security.spec.AlgorithmParameterSpec;
  32 import java.util.Random;
  33 import javax.crypto.Cipher;
  34 import javax.crypto.CipherInputStream;
  35 import javax.crypto.CipherOutputStream;
  36 import javax.crypto.KeyGenerator;
  37 import javax.crypto.NoSuchPaddingException;
  38 import javax.crypto.SecretKey;
  39 import javax.crypto.spec.IvParameterSpec;
  40 
  41 /**
  42  * @test
  43  * @bug 8043836
  44  * @summary Test AES ciphers with different modes and padding schemes (ECB mode
  45  *          doesn't use IV). The test tries 3 different read methods of
  46  *          CipherInputStream.
  47  * @key randomness
  48  */
  49 public class CICO {
  50     private static final String ALGORITHM = "aEs";
  51     private static final String[] MODES = { "PCBC", "ECb", "cbC", "cFB",
  52         "cFB24", "cFB32", "Cfb40", "CFB72", "OfB", "OfB20", "OfB48",
  53         "OfB56", "OFB64", "OFB112", "CFB112", "pCbC" };
  54     private static final String[] PADDING = { "noPadding", "pkcs5padding" };
  55     private static final String PROVIDER = "SunJCE";
  56     private static final int NREADS = 3;
  57     private static final int KEY_LENGTH = 128;
  58 
  59     private final byte[] plainText = new byte[1600000];
  60 
  61 
  62     public static void main(String argv[]) throws Exception {
  63         CICO test = new CICO();
  64         for (String mode : MODES) {
  65             for (String pad : PADDING) {
  66                 for (int m = 0; m < NREADS; m++) {
  67                     test.runTest(ALGORITHM, mode, pad, m);


< prev index next >