0N/A/*
2362N/A * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.crypto;
0N/A
0N/Aimport java.security.*;
0N/Aimport java.security.spec.*;
0N/A
0N/A/**
0N/A * This class provides a delegate for the identity cipher - one that does not
0N/A * tranform the plaintext.
0N/A *
0N/A * @author Li Gong
0N/A * @see Nullcipher
0N/A *
0N/A * @since 1.4
0N/A */
0N/A
0N/Afinal class NullCipherSpi extends CipherSpi {
0N/A
0N/A /*
0N/A * Do not let anybody instantiate this directly (protected).
0N/A */
0N/A protected NullCipherSpi() {}
0N/A
0N/A public void engineSetMode(String mode) {}
0N/A
0N/A public void engineSetPadding(String padding) {}
0N/A
0N/A protected int engineGetBlockSize() {
0N/A return 1;
0N/A }
0N/A
0N/A protected int engineGetOutputSize(int inputLen) {
0N/A return inputLen;
0N/A }
0N/A
0N/A protected byte[] engineGetIV() {
0N/A byte[] x = new byte[8];
0N/A return x;
0N/A }
0N/A
0N/A protected AlgorithmParameters engineGetParameters() {
0N/A return null;
0N/A }
0N/A
0N/A protected void engineInit(int mode, Key key, SecureRandom random) {}
0N/A
0N/A protected void engineInit(int mode, Key key,
0N/A AlgorithmParameterSpec params,
0N/A SecureRandom random) {}
0N/A
0N/A protected void engineInit(int mode, Key key,
0N/A AlgorithmParameters params,
0N/A SecureRandom random) {}
0N/A
0N/A protected byte[] engineUpdate(byte[] input, int inputOffset,
0N/A int inputLen) {
0N/A if (input == null) return null;
0N/A byte[] x = new byte[inputLen];
0N/A System.arraycopy(input, inputOffset, x, 0, inputLen);
0N/A return x;
0N/A }
0N/A
0N/A protected int engineUpdate(byte[] input, int inputOffset,
0N/A int inputLen, byte[] output,
0N/A int outputOffset) {
0N/A if (input == null) return 0;
0N/A System.arraycopy(input, inputOffset, output, outputOffset, inputLen);
0N/A return inputLen;
0N/A }
0N/A
0N/A protected byte[] engineDoFinal(byte[] input, int inputOffset,
0N/A int inputLen)
0N/A {
0N/A return engineUpdate(input, inputOffset, inputLen);
0N/A }
0N/A
0N/A protected int engineDoFinal(byte[] input, int inputOffset,
0N/A int inputLen, byte[] output,
0N/A int outputOffset)
0N/A {
0N/A return engineUpdate(input, inputOffset, inputLen,
0N/A output, outputOffset);
0N/A }
0N/A
0N/A protected int engineGetKeySize(Key key)
0N/A {
0N/A return 0;
0N/A }
0N/A}