System.Security.Cryptography.UnProtect is not working when the windows user password is changed
I am using System.Security.Cryptography.Protect and UnProtect methods to encrypt and decrypt the data with DataProtectionScope as CurrentUser. All works fine until the user changes the windows user Password(due to group policy enforced for password change). It stopped working with an error "Key not valid for use in specified state"
here is an example I have used in the code.
encrypted = ProtectedData.Protect(data, null, DataProtectionScope.CurrentUser);
decrypted = ProtectedData.Unprotect(encryptedData, null, DataProtectionScope.CurrentUser);
Appreciate your help Thanks in Advance.