1 7 8 15 16 package javax.crypto; 17 18 import java.util.StringTokenizer; 19 import java.util.NoSuchElementException; 20 import java.security.AlgorithmParameters; 21 import java.security.Provider; 22 import java.security.Key; 23 import java.security.SecureRandom; 24 import java.security.NoSuchAlgorithmException; 25 import java.security.NoSuchProviderException; 26 import java.security.InvalidKeyException; 27 import java.security.InvalidAlgorithmParameterException; 28 import java.security.ProviderException; 29 import java.security.spec.AlgorithmParameterSpec; 30 import java.nio.ByteBuffer; 31 32 221 public abstract class CipherSpi 222 { 223 224 public CipherSpi() { } 225 226 234 protected abstract void engineSetMode(String mode) 235 throws NoSuchAlgorithmException; 236 237 245 protected abstract void engineSetPadding(String padding) 246 throws NoSuchPaddingException; 247 248 254 protected abstract int engineGetBlockSize(); 255 256 273 protected abstract int engineGetOutputSize(int inputLen); 274 275 285 protected abstract byte[] engineGetIV(); 286 287 298 protected abstract AlgorithmParameters engineGetParameters(); 299 300 340 protected abstract void engineInit(int opmode, Key key, SecureRandom random) 341 throws InvalidKeyException; 342 343 386 protected abstract void engineInit(int opmode, Key key, 387 AlgorithmParameterSpec params, SecureRandom random) 388 throws InvalidKeyException, InvalidAlgorithmParameterException; 389 390 433 protected abstract void engineInit(int opmode, Key key, AlgorithmParameters 434 params, SecureRandom random) 435 throws InvalidKeyException, InvalidAlgorithmParameterException; 436 437 455 protected abstract byte[] engineUpdate(byte[] input, int inputOffset, int 456 inputLen); 457 458 484 protected abstract int engineUpdate(byte[] input, int inputOffset, int 485 inputLen, byte[] output, int outputOffset) throws ShortBufferException; 486 487 517 protected int engineUpdate(ByteBuffer input, ByteBuffer output) 518 throws ShortBufferException 519 { } 520 521 559 protected abstract byte[] engineDoFinal(byte[] input, int inputOffset, int 560 inputLen) throws IllegalBlockSizeException, BadPaddingException; 561 562 609 protected abstract int engineDoFinal(byte[] input, int inputOffset, int 610 inputLen, byte[] output, int outputOffset) 611 throws ShortBufferException, IllegalBlockSizeException, 612 BadPaddingException; 613 614 663 protected int engineDoFinal(ByteBuffer input, ByteBuffer output) 664 throws ShortBufferException, IllegalBlockSizeException, 665 BadPaddingException 666 { } 667 668 692 protected byte[] engineWrap(Key key) 693 throws IllegalBlockSizeException, InvalidKeyException 694 { } 695 696 726 protected Key engineUnwrap(byte[] wrappedKey, String wrappedKeyAlgorithm, 727 int wrappedKeyType) throws InvalidKeyException, NoSuchAlgorithmException 728 { } 729 730 742 protected int engineGetKeySize(Key key) throws InvalidKeyException { } 743 } 744 | Popular Tags |