Encryption using AES-128 in Android and IPhone (Different result)

前端 未结 5 612
误落风尘
误落风尘 2020-12-13 21:57

I am trying to encrypt some text using the AES algorithm on both the Android and IPhone platforms. My problem is, even using the same encryption/decryption algorithm (AES-12

5条回答
  •  温柔的废话
    2020-12-13 22:23

    See my answer for password-based AES encryption, since, you are effectively using your "seed" as a password. (Just change the key length of 256 to 128, if that's what you want.)

    Trying to generate the same key by seeding a DRBG with the same value is not reliable.

    Next, you are not using CBC or the IV in your Android encryption. My example shows how to do that properly too. By the way, you need to generate a new IV for every message you encrypt, as my example shows, and send it along with the cipher text. Otherwise, there's no point in using CBC.

提交回复
热议问题