Java AES 128 encrypting differently to openssl

前端 未结 3 1681
遥遥无期
遥遥无期 2020-11-30 11:51

We\'ve encountered a weird situation where the encryption method we\'re using in Java produces different output to openssl, despite them appearing identical in configuration

3条回答
  •  无人及你
    2020-11-30 12:42

    I believe the difference is the padding, not the actual encrypted data.

    Have you tried to decrypt the strings?

    I believe they will show up as the same.

    Why is the padding different? because they are either implementing it differently, or because one is provided a file, while the other a string, which in the end, when you read them, they are not the same thing (one has an EoF marker, for example).

    BTW: Since it is CBC, Cipher Block Chaining, the whole last block is affected by this padding difference

提交回复
热议问题