jdk/test/com/sun/crypto/provider/Cipher/AES/TestAESCiphers/TestAESWithRemoveAddProvider.java
author valeriep
Fri, 06 Mar 2015 00:49:38 +0000
changeset 29366 fe7c66943ba1
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
/*
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
     2
 * 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
     3
 * 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
     4
 *
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
     5
 * 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
     6
 * 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
     7
 * published by the Free Software Foundation.
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
     8
 *
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
     9
 * 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
    10
 * 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
    11
 * 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
    12
 * 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
    13
 * accompanied this code).
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    14
 *
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    15
 * 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
    16
 * 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
    17
 * 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
    18
 *
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    19
 * 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
    20
 * 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
    21
 * questions.
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
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    24
import java.security.*;
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    25
import java.security.Provider;
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    26
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    27
/*
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    28
 * @test
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    29
 * @bug 8044193
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    30
 * @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
    31
 *  remove default provider then add it back.
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    32
 * @run main/othervm/policy=testAES.policy TestAESWithRemoveAddProvider
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    33
 */
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    34
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    35
public class TestAESWithRemoveAddProvider extends Dynamic {
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    36
    public static void main(String argv[]) throws Exception {
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    37
        Provider pJCE = Security.getProvider(SUNJCE);
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    38
        Security.removeProvider(SUNJCE);
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    39
        Security.addProvider(pJCE);
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    40
        new TestAESWithRemoveAddProvider().run(argv);
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    41
    }
fe7c66943ba1 8044193: Need to add known answer tests for AES cipher
valeriep
parents:
diff changeset
    42
}