Created
October 11, 2014 02:36
-
-
Save john990/bf3175840ac407012e98 to your computer and use it in GitHub Desktop.
AES解密
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String decrypt(String encryptedData) throws Exception { | |
Key key = new SecretKeySpec(KEY.getBytes(), "AES"); | |
Cipher c = Cipher.getInstance("AES/CBC/NoPadding"); | |
IvParameterSpec iv = new IvParameterSpec(IV.getBytes()); | |
c.init(Cipher.DECRYPT_MODE, key,iv); | |
byte[] decValue = c.doFinal(encryptedData.getBytes()); | |
String decryptedValue = new String(decValue); | |
return decryptedValue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment