1 package org.bouncycastle.crypto;
4 * the interface stream ciphers conform to.
6 public interface StreamCipher
9 * Initialise the cipher.
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 * @exception IllegalArgumentException if the params argument is
17 public void init(boolean forEncryption, CipherParameters params)
18 throws IllegalArgumentException;
21 * Return the name of the algorithm the cipher implements.
23 * @return the name of the algorithm the cipher implements.
25 public String getAlgorithmName();
28 * encrypt/decrypt a single byte returning the result.
30 * @param in the byte to be processed.
31 * @return the result of processing the input byte.
33 public byte returnByte(byte in);
36 * process a block of bytes from in putting the result into out.
38 * @param in the input byte array.
39 * @param inOff the offset into the in array where the data to be processed starts.
40 * @param len the number of bytes to be processed.
41 * @param out the output buffer the processed bytes go into.
42 * @param outOff the offset into the output byte array the processed data stars at.
43 * @exception DataLengthException if the output buffer is too small.
45 public void processBytes(byte[] in, int inOff, int len, byte[] out, int outOff)
46 throws DataLengthException;
49 * reset the cipher. This leaves it in the same state
50 * it was at after the last init (if there was one).