DataProtectionScope Enumeration


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

Specifies the scope of the data protection to be applied by the Protect method.

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

type DataProtectionScope

Member nameDescription

The protected data is associated with the current user. Only threads running under the current user context can unprotect the data.


The protected data is associated with the machine context. Any process running on the computer can unprotect data. This enumeration value is usually used in server-specific applications that run on a server where untrusted users are not allowed access.

This enumeration is used with the Protect and Unprotect methods to protect data through encryption.

Caution   The LocalMachine enumeration value allows multiple accounts to unprotect data. Use this value only when you trust every account on a computer. For most situations, you should use the CurrentUser value.

The following code example shows how to use data protection.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top