I am developing a c# .net 3.5 application on Windows 8.
I need to encrypt data using DPAPI. it works ok on all of my machine except from one machine where I get the following exception: System.Security.Cryptography.CryptographicException Message: Access is denied.
byte[] bytes;
bytes = ProtectedData.Protect(Encoding.UTF8.GetBytes(argsStr.ToString()), null, DataProtectionScope.CurrentUser);
when I change the DataProtectionScope.CurrentUser to DataProtectionScope.LocalMachine it works ok.
It seems that someone has denied the access of the current user to preform DAPI encryption
What can i do to fix this issue?
The application that fails is a console application running under the current logged in user.
When running the application using elevated privileges it still failed with access denied.
I tried to reset the login password and it solved the issue.
How can something like that happen?