jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithProviderChange.java
author valeriep
Fri, 06 Mar 2015 00:49:38 +0000
changeset 29366 fe7c66943ba1
child 30820 0d4717a011d3
permissions -rw-r--r--
8044193: Need to add known answer tests for AES cipher Summary: Added more tests for AES cipher using known test vectors. Reviewed-by: valeriep Contributed-by: Zaiyao Liu <zaiyao.liu@oracle.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29366
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
     1
/* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
     3
 *
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
     6
 * published by the Free Software Foundation.
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
     7
 *
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
     8
 * This code is distributed in the hope that it will be useful, but WITHOUT
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
     9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    10
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    11
 * version 2 for more details (a copy is included in the LICENSE file that
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    12
 * accompanied this code).
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    13
 *
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License version
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    15
 * 2 along with this work; if not, write to the Free Software Foundation,
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    16
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    17
 *
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    18
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    19
 * or visit www.oracle.com if you need additional information or have any
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    20
 * questions.
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    21
 */
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    22
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    23
import java.security.Security;
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    24
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    25
/*
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    26
 * @test
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    27
 * @bug 8044193
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    28
 * @summary Test AES ciphers with different modes and padding schemes after
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    29
 *  remove then add provider.
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    30
 * @run main/othervm/policy=testAES.policy TestAESWithProviderChange
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    31
 */
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    32
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    33
public class TestAESWithProviderChange extends Dynamic {
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    34
    public static void main(String argv[]) throws Exception {
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    35
        Security.removeProvider(SUNJCE);
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    36
        Security.addProvider(new com.sun.crypto.provider.SunJCE());
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    37
        new TestAESWithProviderChange().run(argv);
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    38
    }
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    39
}