javax.crypto.BadPaddingException:Given final block not properly padded

后端 未结 4 1619
忘了有多久
忘了有多久 2021-02-04 07:50

I have to decrypt a frame on my server. Encrypted frame comes from client device through GPRS on socket.Encryption is done with TripleDes and

4条回答
  •  春和景丽
    2021-02-04 08:03

    If the documentation does not tell you what padding is being used on the incoming cyphertext, then decrypt with "NoPadding", which will accept any sort of padding on the last block. Then have a look at the hex of your last block. That will tell you what padding is being used at the encrypting end. Amend your code to expect the correct type of padding. The different types of padding are covered here.

提交回复
热议问题