01: package org.bouncycastle.crypto;
02:
03: /**
04: * the interface stream ciphers conform to.
05: */
06: public interface StreamCipher {
07: /**
08: * Initialise the cipher.
09: *
10: * @param forEncryption if true the cipher is initialised for
11: * encryption, if false for decryption.
12: * @param params the key and other data required by the cipher.
13: * @exception IllegalArgumentException if the params argument is
14: * inappropriate.
15: */
16: public void init(boolean forEncryption, CipherParameters params)
17: throws IllegalArgumentException;
18:
19: /**
20: * Return the name of the algorithm the cipher implements.
21: *
22: * @return the name of the algorithm the cipher implements.
23: */
24: public String getAlgorithmName();
25:
26: /**
27: * encrypt/decrypt a single byte returning the result.
28: *
29: * @param in the byte to be processed.
30: * @return the result of processing the input byte.
31: */
32: public byte returnByte(byte in);
33:
34: /**
35: * process a block of bytes from in putting the result into out.
36: *
37: * @param in the input byte array.
38: * @param inOff the offset into the in array where the data to be processed starts.
39: * @param len the number of bytes to be processed.
40: * @param out the output buffer the processed bytes go into.
41: * @param outOff the offset into the output byte array the processed data starts at.
42: * @exception DataLengthException if the output buffer is too small.
43: */
44: public void processBytes(byte[] in, int inOff, int len, byte[] out,
45: int outOff) throws DataLengthException;
46:
47: /**
48: * reset the cipher. This leaves it in the same state
49: * it was at after the last init (if there was one).
50: */
51: public void reset();
52: }
|