String decrypt(byte[] cryptoBytes, byte[] key, byte[] iv) { BlockCipher cipher = new PaddedBufferedBlockCipher(new CBCBlockCipher(new AESEngine())); cipher.init(false, new ParametersWithIV(new KeyParameter(key), iv)); byte[] out = new byte[cipher.getOutputSize(cryptoBytes.length)]; int offset = cipher.processBytes(cryptoBytes, 0, cryptoBytes.length, out, 0); cipher.doFinal(out, offset); return new String(out); }