4056N/A/*
4056N/A * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
4056N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4056N/A *
4056N/A * This code is free software; you can redistribute it and/or modify it
4056N/A * under the terms of the GNU General Public License version 2 only, as
4056N/A * published by the Free Software Foundation.
4056N/A *
4056N/A * This code is distributed in the hope that it will be useful, but WITHOUT
4056N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4056N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4056N/A * version 2 for more details (a copy is included in the LICENSE file that
4056N/A * accompanied this code).
4056N/A *
4056N/A * You should have received a copy of the GNU General Public License version
4056N/A * 2 along with this work; if not, write to the Free Software Foundation,
4056N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4056N/A *
4056N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4056N/A * or visit www.oracle.com if you need additional information or have any
4056N/A * questions.
4056N/A *
4056N/A */
4056N/A
4056N/A/**
4056N/A * @author Tom Deneau
4056N/A */
4056N/A
4056N/Aimport javax.crypto.Cipher;
4056N/A
4056N/Apublic class TestAESDecode extends TestAESBase {
4056N/A @Override
4056N/A public void run() {
4056N/A try {
4056N/A if (!noReinit) dCipher.init(Cipher.DECRYPT_MODE, key, algParams);
4056N/A if (checkOutput) {
4056N/A // checked version creates new output buffer each time
4056N/A decode = dCipher.doFinal(encode, 0, encode.length);
4056N/A compareArrays(decode, expectedDecode);
4056N/A } else {
4056N/A // non-checked version outputs to existing encode buffer for maximum speed
4056N/A decode = new byte[dCipher.getOutputSize(encode.length)];
4056N/A dCipher.doFinal(encode, 0, encode.length, decode);
4056N/A }
4056N/A }
4056N/A catch (Exception e) {
4056N/A e.printStackTrace();
4056N/A System.exit(1);
4056N/A }
4056N/A }
4056N/A
4056N/A @Override
4056N/A void childShowCipher() {
4056N/A showCipher(dCipher, "Decryption");
4056N/A }
4056N/A
4056N/A}