在Android / Java中的cipher.doFinal中传递什么?

String apiResponse = "EcUZvMif

方法:

protected void decryptDataWithAES(String apiResponse, String key) {

try {

es(StandardCharsets.UTF_8);

byte[] decodedResult = Base64.decode(apiResponse, Base64.NO_WRAP);

terSpec = new IvParameterSpec(first16ByteArray);

SecretKeySpec skey = new SecretKeySpec(byteArray, "AES");

Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");

cipher.init(DECRYPT_MODE, skey, ivParameterSpec);

String decryptString = new String(cipher.doFinal(byteArray), StandardCharsets.UTF_8);

showLog("JSON: " + decryptString);

} catch (Exception e) {

e.printStackTrace();

}

}

例外: javax.crypto.BadPaddingException: error:1e000065:Cipher

functions:OPENSSL_internal:BAD_DECRYPT

[wefopwfpkpewfpkoewfkowf ewfwefwefpwfpkpewfpkoewfkowf

ewfwefwefpwfpkpewfpkoewfkowf ewfwefwefpwfpkpewfpkoewfkowf

ewfwefwefpwfpkpewfpkoewfkowf ewfwefwefpwfpkpewfpkoewfkowf

ewfwefwefpwfpkpewfpkoewfkowf ewfwefwefpwfpkpewfpkoewfkowf

ewfwefwefpwfpkpewfpkoewfkowf ewfwefwefpwfpkpewfpkoewfkowf

ewfwefwefpwfpkpewfpkoewfkowf ewfwefwefpwfpkpewfpkoewfkowf ewfwefwef] bhdfuiyh

回答:

您正在尝试解密“密钥”,我认为您需要解密apiResponse

另外,您需要使用与邮件加密时完全相同的IV,否则您将无法解密

以上是 在Android / Java中的cipher.doFinal中传递什么? 的全部内容, 来源链接: utcz.com/qa/430761.html

回到顶部