Search code examples
c#performancecryptographydpapi

Data protection API suddenly very slow


Our application is using the Data Protection API (via the ProtectedData class) to encrypt a password before storing it. It was working fine until recenly, but suddenly the Protect method started taking 2 seconds to return (instead of about 0.5ms). Things to note:

  • it still works normally on my colleagues' machines
  • we're using DataProtectionScope.CurrentUser; if I switch to DataProtectionScope.LocalMachine, it works normally again (but that's not what I want)
  • I tried to restart the crypto service, which had no effect
  • I tried to restart the computer, which had no effect either

What could be causing this? How can I fix it (preferably without reinstalling Windows)?


Solution

  • The problem disappeared after I changed my account password.