c# - 在 System.Security.Cryptography 中找不到 `DataProtectionScope` 和 `ProtectedData` 类

标签 c# visual-studio-2010 cryptography

我已经按照 this article 中的描述引用了文件 System.Security.dll但是根据我的 IDE,行 using System.Security.Cryptography; 可以安全地删除,因为它没有被使用。

同一 IDE 告诉我 DataProtectionScopeProtectedData 出错。这些应该在that 命名空间中。但是,当我在包裹中点点时,我看不到它们。

文章有错吗?如何访问这两个类?

最佳答案

正如@Coral Doe 在@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."

这解决了我的问题。具体来说,我执行了以下步骤:

  1. 在 Visual Studio 中打开项目。
  2. 在“解决方案资源管理器”中右键单击项目名称,然后选择“属性”。
  3. 单击左侧的“引用”选项卡。
  4. 单击“添加”按钮。
  5. 单击 .NET 选项卡。
  6. 选择 System.Security 并单击“确定”以添加引用。

希望这对您有所帮助。

关于c# - 在 System.Security.Cryptography 中找不到 `DataProtectionScope` 和 `ProtectedData` 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12526189/

相关文章:

java - Java中对Radix64字符进行按位运算

cryptography - 在密码学中使用字节数组和十六进制值

c# - 未在 C# 中设置对象属性

wpf - 如何使用 Resharper 使 XAML 编辑更具响应性

cryptography - OpenSC 无法将 javacard 与 PKCS 小程序连接

.net - 在Visual Studio编辑器中检测事件

c# - 如何使用内部委托(delegate)克隆对象

c# - MVC - 有没有办法在模型中声明具有相同属性、不同名称的多个属性

c# - 发现空格时 DateTime.TryParse 应该失败

c# - 如何通过Escape键正确取消并行异步IO任务?