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

前端 未结 9 1560
醉酒成梦
醉酒成梦 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

    I had a similar problem, the issue in decrypt method was initializing an empty memory stream. when it worked when I initialized it with the cipher text byte array like this:

    MemoryStream ms = new MemoryStream(cipherText)
    

提交回复
热议问题