Answer the question
In order to leave comments, you need to log in
How to fix password decryption error?
I am writing a c# program that displays data (logins, passwords, etc.) to the user in browsers, and the problem is that an exception appears at the decryption stage: System.Security.Cryptography.CryptographicException: "The parameter is set incorrectly."
I can't fix it, here's that part of the code
public static string Decrypt(string EncryptedData)
{
if (EncryptedData == null || EncryptedData.Length == 0)
{
return null;
}
byte[] bytes = ProtectedData.Unprotect(Encoding.Default.GetBytes(EncryptedData),null,DataProtectionScope.CurrentUser);//ошибка тут
return Encoding.UTF8.GetString(bytes);
}
Answer the question
In order to leave comments, you need to log in
Error somewhere in
ProtectedData.Unprotect(Encoding.Default.GetBytes(EncryptedData),null,DataProtectionScope.CurrentUser)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question