Cipher pad block corrupted on Gingerbread

前端 未结 3 1587
小鲜肉
小鲜肉 2021-02-04 23:02

I believe this is a snippet from androidsnippets.org - why this isn\'t funcioning on Android 2.3? How to fix it?

Error

相关标签:
3条回答
  • 2021-02-04 23:22

    NickT says: "is going to give the same result of 3 for strings of length 6 and 7 (say)" I suppose that length of HEX string in that case is always EVEN number (see function appendHex)

    0 讨论(0)
  • 2021-02-04 23:30

    Two points:

    1) The toByte() method isn't clear what it's trying to do, but I'll bet it's wrong, as the line

    int len = hexString.length()/2;
    

    is going to give the same result of 3 for strings of length 6 and 7 (say)

    2) You can't rely on converting stings to byte arrays without specifying the Charset to use. Different locales and different run machines may have different default Charsets. You should probably use str.getBytes("UTF8") in the algorithm.

    0 讨论(0)
  • 2021-02-04 23:30

    It's problem with BouncyCastle (BouncyCastle AES error when upgrading to 1.45).

    What I have found is that this results in two different values for BC 1.34 vs 1.45.

    I couldn't find the solution, yet...

    0 讨论(0)
提交回复
热议问题