public byte[] decrypt(byte[] bytesToDecode,CharSequence password) throws KeyCrypterException {
  try {
    byte[] salt=new byte[SALT_LENGTH];
    System.arraycopy(bytesToDecode,0,salt,0,SALT_LENGTH);
    byte[] cipherBytes=new byte[bytesToDecode.length - SALT_LENGTH];
    System.arraycopy(bytesToDecode,SALT_LENGTH,cipherBytes,0,bytesToDecode.length - SALT_LENGTH);
    ParametersWithIV key=(ParametersWithIV)getAESPasswordKey(password,salt);
    BufferedBlockCipher cipher=new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESFastEngine()));
    cipher.init(false,key);
    byte[] decryptedBytes=new byte[cipher.getOutputSize(cipherBytes.length)];
    final int processLength=cipher.processBytes(cipherBytes,0,cipherBytes.length,decryptedBytes,0);
    final int doFinalLength=cipher.doFinal(decryptedBytes,processLength);
    return Arrays.copyOf(decryptedBytes,processLength + doFinalLength);
  }
 catch (  Exception e) {
    throw new KeyCrypterException("Could not decrypt input string",e);
  }
}

public byte [ ] decrypt ( byte [ ] bytesToDecode , CharSequence password ) throws KeyCrypterException { try { byte [ ] salt = new byte [ SALT_LENGTH ] ; System . arraycopy ( bytesToDecode , 0 , salt , 0 , SALT_LENGTH ) ; byte [ ] cipherBytes = new byte [ bytesToDecode . length - SALT_LENGTH ] ; System . arraycopy ( bytesToDecode , SALT_LENGTH , cipherBytes , 0 , bytesToDecode . length - SALT_LENGTH ) ; ParametersWithIV key = ( ParametersWithIV ) getAESPasswordKey ( password , salt ) ; BufferedBlockCipher cipher = new PaddedBufferedBlockCipher ( new CBCBlockCipher ( new AESFastEngine ( ) ) ) ; cipher . init ( false , key ) ; byte [ ] decryptedBytes = new byte [ cipher . getOutputSize ( cipherBytes . length ) ] ; final int processLength = cipher . processBytes ( cipherBytes , 0 , cipherBytes . length , decryptedBytes , 0 ) ; final int doFinalLength = cipher . doFinal ( decryptedBytes , processLength ) ; return Arrays . copyOf ( decryptedBytes , processLength + doFinalLength ) ; } catch ( Exception e ) { throw new KeyCrypterException ( "Could not decrypt input string" , e ) ; } }
decrypt bytes previously encrypted with this class .
