< prev index next >

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

Print this page




  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 TestSameBuffer {
  47 
  48     private static final String ALGORITHM = "Rijndael";
  49     private static final String PROVIDER = "SunJCE";
  50     private static final String[] MODES = { "ECb", "CbC", "OFB", "CFB150",
  51         "cFB", "CFB7", " cFB8", "cFB16", "cFB24", "cFB32", "Cfb40",
  52         "cfB48", " cfB56", "cfB64", "cfB72", "cfB80", "cfB88", "cfB96",
  53         "cfb104", "cfB112", "cfB120" };
  54     private static final String PADDING = "NoPadding";
  55     private static final int KEY_LENGTH = 128;
  56 
  57     public static void main(String argv[]) throws Exception {
  58         TestSameBuffer test = new TestSameBuffer();
  59         for (String mode : MODES) {
  60             test.runTest(ALGORITHM, mode, PADDING);
  61         }
  62     }
  63 
  64     public void runTest(String algo, String mo, String pad) throws Exception {




  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 TestSameBuffer {
  48 
  49     private static final String ALGORITHM = "Rijndael";
  50     private static final String PROVIDER = "SunJCE";
  51     private static final String[] MODES = { "ECb", "CbC", "OFB", "CFB150",
  52         "cFB", "CFB7", " cFB8", "cFB16", "cFB24", "cFB32", "Cfb40",
  53         "cfB48", " cfB56", "cfB64", "cfB72", "cfB80", "cfB88", "cfB96",
  54         "cfb104", "cfB112", "cfB120" };
  55     private static final String PADDING = "NoPadding";
  56     private static final int KEY_LENGTH = 128;
  57 
  58     public static void main(String argv[]) throws Exception {
  59         TestSameBuffer test = new TestSameBuffer();
  60         for (String mode : MODES) {
  61             test.runTest(ALGORITHM, mode, PADDING);
  62         }
  63     }
  64 
  65     public void runTest(String algo, String mo, String pad) throws Exception {


< prev index next >