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