Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static String decryptAESData(String base64String, String key) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
- SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "AES");
- Cipher cipher = Cipher.getInstance("AES");
- cipher.init(Cipher.DECRYPT_MODE, keySpec);
- byte[] encryptedBytes = Base64.decodeBase64(base64String.getBytes());
- byte[] decrypted = cipher.doFinal(encryptedBytes);
- return new String(decrypted);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement