1 7 8 package javax.crypto; 9 10 import java.security.*; 11 import java.security.spec.*; 12 13 25 26 final class NullCipherSpi extends CipherSpi { 27 28 31 protected NullCipherSpi() {} 32 33 public void engineSetMode(String mode) {} 34 35 public void engineSetPadding(String padding) {} 36 37 protected int engineGetBlockSize() { 38 return 1; 39 } 40 41 protected int engineGetOutputSize(int inputLen) { 42 return inputLen; 43 } 44 45 protected byte[] engineGetIV() { 46 byte[] x = new byte[8]; 47 return x; 48 } 49 50 protected AlgorithmParameters engineGetParameters() { 51 return null; 52 } 53 54 protected void engineInit(int mode, Key key, SecureRandom random) {} 55 56 protected void engineInit(int mode, Key key, 57 AlgorithmParameterSpec params, 58 SecureRandom random) {} 59 60 protected void engineInit(int mode, Key key, 61 AlgorithmParameters params, 62 SecureRandom random) {} 63 64 protected byte[] engineUpdate(byte[] input, int inputOffset, 65 int inputLen) { 66 if (input == null) return null; 67 byte[] x = new byte[inputLen]; 68 System.arraycopy(input, inputOffset, x, 0, inputLen); 69 return x; 70 } 71 72 protected int engineUpdate(byte[] input, int inputOffset, 73 int inputLen, byte[] output, 74 int outputOffset) { 75 if (input == null) return 0; 76 System.arraycopy(input, inputOffset, output, outputOffset, inputLen); 77 return inputLen; 78 } 79 80 protected byte[] engineDoFinal(byte[] input, int inputOffset, 81 int inputLen) 82 { 83 return engineUpdate(input, inputOffset, inputLen); 84 } 85 86 protected int engineDoFinal(byte[] input, int inputOffset, 87 int inputLen, byte[] output, 88 int outputOffset) 89 { 90 return engineUpdate(input, inputOffset, inputLen, 91 output, outputOffset); 92 } 93 94 protected int engineGetKeySize(Key key) 95 { 96 return 0; 97 } 98 } 99 | Popular Tags |