Home | History | Annotate | Download | only in crypto
      1 /* GENERATED SOURCE. DO NOT MODIFY. */
      2 package com.android.org.bouncycastle.crypto;
      3 
      4 
      5 /**
      6  * Block cipher engines are expected to conform to this interface.
      7  * @hide This class is not part of the Android public SDK API
      8  */
      9 public interface BlockCipher
     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 params the key and other data required by the cipher.
     17      * @exception IllegalArgumentException if the params argument is
     18      * inappropriate.
     19      */
     20     public void init(boolean forEncryption, CipherParameters params)
     21         throws IllegalArgumentException;
     22 
     23     /**
     24      * Return the name of the algorithm the cipher implements.
     25      *
     26      * @return the name of the algorithm the cipher implements.
     27      */
     28     public String getAlgorithmName();
     29 
     30     /**
     31      * Return the block size for this cipher (in bytes).
     32      *
     33      * @return the block size for this cipher in bytes.
     34      */
     35     public int getBlockSize();
     36 
     37     /**
     38      * Process one block of input from the array in and write it to
     39      * the out array.
     40      *
     41      * @param in the array containing the input data.
     42      * @param inOff offset into the in array the data starts at.
     43      * @param out the array the output data will be copied into.
     44      * @param outOff the offset into the out array the output will start at.
     45      * @exception DataLengthException if there isn't enough data in in, or
     46      * space in out.
     47      * @exception IllegalStateException if the cipher isn't initialised.
     48      * @return the number of bytes processed and produced.
     49      */
     50     public int processBlock(byte[] in, int inOff, byte[] out, int outOff)
     51         throws DataLengthException, IllegalStateException;
     52 
     53     /**
     54      * Reset the cipher. After resetting the cipher is in the same state
     55      * as it was after the last init (if there was one).
     56      */
     57     public void reset();
     58 }
     59