入参:encryptedData,IV,sessionKeyCipher cipher = Cipher.getInstance(“AES/CBC/NoPadding”);
sun.misc.BASE64Decoder base64Decoder = new sun.misc.BASE64Decoder();
byte[] _encryptedData = base64Decoder.decodeBuffer(encryptedData);
byte[] _sessionKey = base64Decoder.decodeBuffer(sessionKey);
byte[] _iv = base64Decoder.decodeBuffer(iv);
SecretKeySpec secretKeySpec = new SecretKeySpec(_sessionKey, “AES”);
IvParameterSpec ivParameterSpec = new IvParameterSpec(_iv);
cipher.init(Cipher.DECRYPT_MODE, secretKeySpec, ivParameterSpec);
byte[] original = cipher.doFinal(_encryptedData);
PKCS7Encoder pk = new PKCS7Encoder();
byte[] bytes = pk.decode(original);
String originalString = new String(bytes, “utf-8”);
System.out.println(“originalString1=”+originalString);
这是解码的代码,基本上第二次,就会出现乱码,怎么解决?