< prev index next >

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

Print this page




  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8012900
  27  * @library ../UTIL
  28  * @build TestUtil
  29  * @run main TestCICOWithGCMAndAAD
  30  * @summary Test CipherInputStream/OutputStream with AES GCM mode with AAD.
  31  * @author Valerie Peng

  32  */
  33 import java.io.*;
  34 import java.security.*;
  35 import java.util.*;
  36 import javax.crypto.*;
  37 
  38 public class TestCICOWithGCMAndAAD {
  39     public static void main(String[] args) throws Exception {
  40         //init Secret Key
  41         KeyGenerator kg = KeyGenerator.getInstance("AES", "SunJCE");
  42         kg.init(128);
  43         SecretKey key = kg.generateKey();
  44 
  45         //Do initialization of the plainText
  46         byte[] plainText = new byte[700];
  47         Random rdm = new Random();
  48         rdm.nextBytes(plainText);
  49 
  50         byte[] aad = new byte[128];
  51         rdm.nextBytes(aad);




  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8012900
  27  * @library ../UTIL
  28  * @build TestUtil
  29  * @run main TestCICOWithGCMAndAAD
  30  * @summary Test CipherInputStream/OutputStream with AES GCM mode with AAD.
  31  * @author Valerie Peng
  32  * @key randomness
  33  */
  34 import java.io.*;
  35 import java.security.*;
  36 import java.util.*;
  37 import javax.crypto.*;
  38 
  39 public class TestCICOWithGCMAndAAD {
  40     public static void main(String[] args) throws Exception {
  41         //init Secret Key
  42         KeyGenerator kg = KeyGenerator.getInstance("AES", "SunJCE");
  43         kg.init(128);
  44         SecretKey key = kg.generateKey();
  45 
  46         //Do initialization of the plainText
  47         byte[] plainText = new byte[700];
  48         Random rdm = new Random();
  49         rdm.nextBytes(plainText);
  50 
  51         byte[] aad = new byte[128];
  52         rdm.nextBytes(aad);


< prev index next >