1 package org.bouncycastle.crypto; 2 3 import java.math.BigInteger; 4 5 /** 6 * base interface that a public/private key block cipher needs 7 * to conform to. 8 */ 9 public interface AsymmetricBlockCipher 10 { 11 /** 12 * initialise the cipher. 13 * 14 * @param forEncryption if true the cipher is initialised for 15 * encryption, if false for decryption. 16 * @param param the key and other data required by the cipher. 17 */ 18 public void init(boolean forEncryption, CipherParameters param); 19 20 /** 21 * returns the largest size an input block can be. 22 * 23 * @return maximum size for an input block. 24 */ 25 public int getInputBlockSize(); 26 27 /** 28 * returns the maximum size of the block produced by this cipher. 29 * 30 * @return maximum size of the output block produced by the cipher. 31 */ 32 public int getOutputBlockSize(); 33 34 /** 35 * process the block of len bytes stored in in from offset inOff. 36 * 37 * @param in the input data 38 * @param inOff offset into the in array where the data starts 39 * @param len the length of the block to be processed. 40 * @return the resulting byte array of the encryption/decryption process. 41 * @exception InvalidCipherTextException data decrypts improperly. 42 * @exception DataLengthException the input data is too large for the cipher. 43 */ 44 public byte[] processBlock(byte[] in, int inOff, int len) 45 throws InvalidCipherTextException; 46 } 47