< prev index next >

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

Print this page




  26 import java.security.NoSuchAlgorithmException;
  27 import java.security.NoSuchProviderException;
  28 import java.security.spec.AlgorithmParameterSpec;
  29 import java.util.Arrays;
  30 import java.util.Random;
  31 import javax.crypto.BadPaddingException;
  32 import javax.crypto.Cipher;
  33 import javax.crypto.IllegalBlockSizeException;
  34 import javax.crypto.KeyGenerator;
  35 import javax.crypto.NoSuchPaddingException;
  36 import javax.crypto.SecretKey;
  37 import javax.crypto.ShortBufferException;
  38 import javax.crypto.spec.IvParameterSpec;
  39 
  40 
  41 /**
  42  * @test
  43  * @bug 8043836
  44  * @summary Test AES ciphers with 4 different modes with NoPadding. Check if
  45  *          data before encryption and after decryption is the same.

  46  */
  47 
  48 public class CTR {
  49 
  50     private static final String ALGORITHM = "AES";
  51 
  52     private static final String PROVIDER = "SunJCE";
  53 
  54     private static final String[] MODES = {"CTR","CFB24","OFB32","GCM"};
  55 
  56     private static final String PADDING = "NoPadding";
  57 
  58 
  59     private static final int KEY_LENGTH = 128;
  60 
  61     public static void main(String argv[]) throws Exception {
  62         CTR test = new CTR();
  63         for (String mode : MODES) {
  64             test.runTest(ALGORITHM, mode, PADDING);
  65         }




  26 import java.security.NoSuchAlgorithmException;
  27 import java.security.NoSuchProviderException;
  28 import java.security.spec.AlgorithmParameterSpec;
  29 import java.util.Arrays;
  30 import java.util.Random;
  31 import javax.crypto.BadPaddingException;
  32 import javax.crypto.Cipher;
  33 import javax.crypto.IllegalBlockSizeException;
  34 import javax.crypto.KeyGenerator;
  35 import javax.crypto.NoSuchPaddingException;
  36 import javax.crypto.SecretKey;
  37 import javax.crypto.ShortBufferException;
  38 import javax.crypto.spec.IvParameterSpec;
  39 
  40 
  41 /**
  42  * @test
  43  * @bug 8043836
  44  * @summary Test AES ciphers with 4 different modes with NoPadding. Check if
  45  *          data before encryption and after decryption is the same.
  46  * @key randomness
  47  */
  48 
  49 public class CTR {
  50 
  51     private static final String ALGORITHM = "AES";
  52 
  53     private static final String PROVIDER = "SunJCE";
  54 
  55     private static final String[] MODES = {"CTR","CFB24","OFB32","GCM"};
  56 
  57     private static final String PADDING = "NoPadding";
  58 
  59 
  60     private static final int KEY_LENGTH = 128;
  61 
  62     public static void main(String argv[]) throws Exception {
  63         CTR test = new CTR();
  64         for (String mode : MODES) {
  65             test.runTest(ALGORITHM, mode, PADDING);
  66         }


< prev index next >