Specified padding mode is not valid for this algorithm - c# - System.Security.Cryptography

前端 未结 1 1863
没有蜡笔的小新
没有蜡笔的小新 2020-12-20 15:04

pretty new to c# and currently having a problem decrypting long passwords with an error of

Specified key is not a valid size for this algorithm

<
1条回答
  •  -上瘾入骨i
    2020-12-20 15:23

    Two changes are required in the function public string DecryptString(string cipherText)

     var cipher = new byte[fullCipher.Length - IV.Length];
    

    and

     Buffer.BlockCopy(fullCipher, IV.Length, cipher, 0, fullCipher.Length - IV.Length);
    

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