Skip to content

Instantly share code, notes, and snippets.

@john990
Created October 11, 2014 02:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save john990/bf3175840ac407012e98 to your computer and use it in GitHub Desktop.
Save john990/bf3175840ac407012e98 to your computer and use it in GitHub Desktop.
AES解密
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