Decrypting data on desktop that was encrypted on android

后端 未结 2 1515
臣服心动
臣服心动 2021-02-11 09:47

I have an app which encrypts some text strings, and then writes these to a file. The desktop version of the app is reading the file and decrypts the data. The problem is that wh

2条回答
  •  甜味超标
    2021-02-11 09:58

    There are at least two problems with your code that will affect its functionality on different platforms:

    1. You must specify a character set when calling getBytes() or new String(...). Without this, the results will be different if your platforms have different default charsets.

    2. You must fully specify your encryption algorithm, e.g. replace "AES" with "AES/CBC/PKCS5Padding" to avoid differences between providers.

提交回复
热议问题