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