System.arraycopy(data, 0, newData, 0, data.length);
return newData;
}
private static byte[] decrypt(String algorithm, byte[] key, byte[] data) {
BlockCipher cipher = CipherFactory.getBlockCipher(algorithm);
byte[] newKey = getPaddedArrayCopy(key, cipher.getKeyLength());
cipher.setKey(newKey);
byte[] newData = getPaddedArrayCopy(data, BlockCipher.ALIGN);
cipher.decrypt(newData, 0, newData.length);
return newData;
}