Why does a bad password cause “Padding is invalid and cannot be removed”?

前端 未结 9 1559
醉酒成梦
醉酒成梦 2020-11-29 07:24

I needed some simple string encryption, so I wrote the following code (with a great deal of \"inspiration\" from here):

    // create and initialize a crypto         


        
9条回答
  •  無奈伤痛
    2020-11-29 07:43

    The answer updated by the user "atconway" worked for me.

    The problem was not with the padding but the key which was different during encryption and decryption. The key and iv should be same during encypting and decrypting the same value.

提交回复
热议问题