We have this C# code to decrypt data:
ProtectedData.Unprotect(pdata, null, DataProtectionScope.CurrentUser);
The method throws "Key not valid for use in specified state."
The data was originally encrypted on a different machine with same ID.
According to the MSDN documentation for this method:
If you use this method during impersonation, you may receive the following error: "Key not valid for use in specified state." To prevent this error, load the profile of the user you want to impersonate before calling the method.
I don't really understand the last sentence. How do I load the profile of the user I want to impersonate?