jdk/test/sun/security/pkcs11/Cipher/TestSymmCiphersNoPad.java
changeset 35379 1e8e336ef66b
parent 30046 cf2c86e1819e
child 40975 680639c9b307
equal deleted inserted replaced
35378:7e19fa0e4e5b 35379:1e8e336ef66b
     1 /*
     1 /*
     2  * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    26  * @bug 4898484 6604496 8001284
    26  * @bug 4898484 6604496 8001284
    27  * @summary basic test for symmetric ciphers with no padding
    27  * @summary basic test for symmetric ciphers with no padding
    28  * @author Valerie Peng
    28  * @author Valerie Peng
    29  * @library ..
    29  * @library ..
    30  * @key randomness
    30  * @key randomness
       
    31  * @run main/othervm TestSymmCiphersNoPad
       
    32  * @run main/othervm TestSymmCiphersNoPad sm
    31  */
    33  */
    32 
    34 
    33 import java.io.*;
    35 import java.io.ByteArrayInputStream;
    34 import java.nio.*;
    36 import java.io.ByteArrayOutputStream;
    35 import java.util.*;
    37 import java.io.InputStream;
    36 
    38 import java.nio.ByteBuffer;
    37 import java.security.*;
    39 import java.security.AlgorithmParameters;
    38 import java.security.spec.AlgorithmParameterSpec;
    40 import java.security.NoSuchAlgorithmException;
    39 
    41 import java.security.Provider;
    40 import javax.crypto.*;
    42 import java.util.Random;
    41 import javax.crypto.spec.IvParameterSpec;
    43 import javax.crypto.Cipher;
       
    44 import javax.crypto.CipherInputStream;
       
    45 import javax.crypto.KeyGenerator;
       
    46 import javax.crypto.SecretKey;
    42 
    47 
    43 public class TestSymmCiphersNoPad extends PKCS11Test {
    48 public class TestSymmCiphersNoPad extends PKCS11Test {
    44 
    49 
    45     private static class CI { // class for holding Cipher Information
    50     private static class CI { // class for holding Cipher Information
    46         String transformation;
    51         String transformation;
    65         new CI("AES/CTR/NoPadding", "AES", 65)
    70         new CI("AES/CTR/NoPadding", "AES", 65)
    66     };
    71     };
    67 
    72 
    68     private static StringBuffer debugBuf;
    73     private static StringBuffer debugBuf;
    69 
    74 
       
    75     @Override
    70     public void main(Provider p) throws Exception {
    76     public void main(Provider p) throws Exception {
    71         boolean status = true;
    77         boolean status = true;
    72         Random random = new Random();
    78         Random random = new Random();
    73         try {
    79         try {
    74             for (int i = 0; i < TEST_LIST.length; i++) {
    80             for (int i = 0; i < TEST_LIST.length; i++) {
   232         bb.get(bbTemp, 0, bbTemp.length);
   238         bb.get(bbTemp, 0, bbTemp.length);
   233         match(bbTemp, answer);
   239         match(bbTemp, answer);
   234     }
   240     }
   235 
   241 
   236     public static void main(String[] args) throws Exception {
   242     public static void main(String[] args) throws Exception {
   237         main(new TestSymmCiphersNoPad());
   243         main(new TestSymmCiphersNoPad(), args);
   238     }
   244     }
   239 }
   245 }