< prev index next >

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

Print this page




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  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 any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 4517355
  27  * @summary Verify that AES cipher.doFinal method does NOT need more
  28  *      than necessary bytes in decrypt mode
  29  * @author Valerie Peng

  30  */
  31 import java.io.PrintStream;
  32 import java.security.*;
  33 import java.security.spec.*;
  34 import java.util.*;
  35 
  36 import javax.crypto.*;
  37 import javax.crypto.spec.*;
  38 import java.security.Provider;
  39 import com.sun.crypto.provider.*;
  40 
  41 public class Test4517355 {
  42 
  43     private static final String ALGO = "AES";
  44     private static final int KEYSIZE = 16; // in bytes
  45 
  46     private static byte[] plainText = new byte[125];
  47 
  48     public void execute(String mode, String padding) throws Exception {
  49         String transformation = ALGO + "/" + mode + "/" + padding;




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  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 any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 4517355
  27  * @summary Verify that AES cipher.doFinal method does NOT need more
  28  *      than necessary bytes in decrypt mode
  29  * @author Valerie Peng
  30  * @key randomness
  31  */
  32 import java.io.PrintStream;
  33 import java.security.*;
  34 import java.security.spec.*;
  35 import java.util.*;
  36 
  37 import javax.crypto.*;
  38 import javax.crypto.spec.*;
  39 import java.security.Provider;
  40 import com.sun.crypto.provider.*;
  41 
  42 public class Test4517355 {
  43 
  44     private static final String ALGO = "AES";
  45     private static final int KEYSIZE = 16; // in bytes
  46 
  47     private static byte[] plainText = new byte[125];
  48 
  49     public void execute(String mode, String padding) throws Exception {
  50         String transformation = ALGO + "/" + mode + "/" + padding;


< prev index next >