Can't find `DataProtectionScope` and `ProtectedData` classes in System.Security.Cryptography
As @Coral Doe mentioned in a comment under @Dave Lucre:
"Had a similar problem and this worked. using System.Security.Cryptography; didn't [show] me [ProtectedData] and ProtectedMemory until I had referenced the System.Security.dll for the specific framework."
This fixed the issue for me. Specifically, I performed these steps:
- Open the project in Visual Studio.
- Right-click the project's name in Solution Explorer then choose Properties.
- Click the References tab on the left.
- Click the Add button.
- Click the .NET tab.
- Select System.Security and click OK to add the reference.
Hope this helps.
I have referenced the System.Security.dll here: C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Security.dll
Added using System.Security.Cryptography;
and I can see both DataProtectionScope
and ProtectedData
.
I'm targeting the .net 4.0 full framework (not client profile).
What framework are you targeting?
I had to add this NuGet package in addition to System.Security.Cryptography
.
It is https://www.nuget.org/packages/System.Security.Cryptography.ProtectedData/.
After that, System.Security.Cryptography
became "used".