BadPaddingException when decrypting AES with the same key

前端 未结 2 1323
盖世英雄少女心
盖世英雄少女心 2021-02-06 14:12

This is the tester:

public class CryptographySimpleTests extends ActivityTestCase
{
    public void testsCryptographyClass_encryptAndDecrypt()
    {
        fina         


        
2条回答
  •  说谎
    说谎 (楼主)
    2021-02-06 14:57

    I'm using CBC without an IvParameterSpec.

    It was solved adding the following to encrypt and decrypt:

    cipher.init(Cipher."mode here", sKeyS, getIvSpecAES256()); 
    

    Where "getIvSpecAES256()" return the same value always.

提交回复
热议问题