DpapiDataProtector 类

定义

提供简单数据保护方法。

public ref class DpapiDataProtector sealed : System::Security::Cryptography::DataProtector
public sealed class DpapiDataProtector : System.Security.Cryptography.DataProtector
type DpapiDataProtector = class
    inherit DataProtector
Public NotInheritable Class DpapiDataProtector
Inherits DataProtector
继承
DpapiDataProtector

注解

DpapiDataProtector 提供了使用 类保护数据的 ProtectedData 结构化方法。 类构造函数具有类似于密码的用途参数,用于标识受保护的数据。 所有三个参数都经过哈希处理,并作为加密数据字符串的一部分包含在内。 必须知道用途参数才能取消保护数据。 ProtectedData.Protect调用以加密数据的方法具有一个optionalEntropy参数,可用于添加限定信息以更安全地加密数据。 用途参数的哈希用于可选熵。 由于不需要密钥来解密数据,因此仔细选择用途数据可为数据保护增加另一个安全级别。

如果使用 Scope 的设置 CurrentUser,则只有具有与加密数据的用户相匹配的登录凭据的用户才能解密数据。 此外,通常只能在加密数据的计算机上进行解密。 加密数据的 Windows 函数会创建一个会话密钥来执行加密。 解密数据时,将再次派生会话密钥。 有关如何使用会话密钥保护数据的详细说明,请参阅 Windows 数据保护

如果在保护数据时使用 Scope 设置 LocalMachine ,并且未仔细标识用途参数,则计算机上知道用途的任何其他应用程序都可以访问和取消保护数据。

构造函数

DpapiDataProtector(String, String, String[])

使用指定应用程序名称、主要用途和具体目的,创建 DpapiDataProtector 类的新实例。

属性

ApplicationName

获取应用程序的名称。

(继承自 DataProtector)
PrependHashedPurposeToPlaintext

指定哈希是否已附加到加密前的文本数组。

(继承自 DataProtector)
PrimaryPurpose

获取保护的数据的主要目的。

(继承自 DataProtector)
Scope

获取或设置数据保护的范围。

SpecificPurposes

获取保护数据的指定目的。

(继承自 DataProtector)

方法

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetHashedPurpose()

创建由构造函数指定的属性值的哈希。

(继承自 DataProtector)
GetType()

获取当前实例的 Type

(继承自 Object)
IsReprotectRequired(Byte[])

确定如果数据必须加再密数据。

MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
Protect(Byte[])

保护指定用户数据。

(继承自 DataProtector)
ProviderProtect(Byte[])

指定基类中回调的 Protect(Byte[]) 方法中派生类的委托方法。

(继承自 DataProtector)
ProviderUnprotect(Byte[])

指定基类中回调的 Unprotect(Byte[]) 方法中派生类的委托方法。

(继承自 DataProtector)
ToString()

返回表示当前对象的字符串。

(继承自 Object)
Unprotect(Byte[])

取消对指定保护数据保护。

(继承自 DataProtector)

适用于