DpapiDataProtector Constructor (String, String, String[])

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Creates a new instance of the DpapiDataProtector class by using the specified application name, primary purpose, and specific purposes.

Namespace:   System.Security.Cryptography
Assembly:  System.Security (in System.Security.dll)

new : 
        appName:string *
        primaryPurpose:string *
        [<ParamArrayAttribute>] specificPurpose:string[] -> DpapiDataProtector


Type: System.String

The name of the application.

Type: System.String

The primary purpose for the data protector.

Type: System.String[]

The specific purpose(s) for the data protector.

Exception Condition

appName is an empty string or null.


primaryPurpose is an empty string or null.


specificPurposes contains an empty string or null.

The application name specified by the appName parameter is considered to be a part of the purpose for the protected data. The three parameters are hashed, and the hash is used for both protecting and unprotecting the data. Examples of primaryPurpose and specificPurposes values are Giftcard and <gift card number> or Invoice and <invoice number>.


for protecting data. Security action: Demand. Associated enumeration: Unrestricted.

.NET Framework
Available since 4.5
Return to top