DataProtection Class
Represents the ability to encrypt and decrypt strings using the Windows Data Protection API (DPAPI).
Inheritance Hierarchy
System.Object
Microsoft.VisualStudio.Data.DataProtection
Namespace: Microsoft.VisualStudio.Data
Assembly: Microsoft.VisualStudio.Data (in Microsoft.VisualStudio.Data.dll)
Syntax
'Declaración
Public NotInheritable Class DataProtection
public sealed class DataProtection
public ref class DataProtection sealed
[<Sealed>]
type DataProtection = class end
public final class DataProtection
The DataProtection type exposes the following members.
Methods
Name | Description | |
---|---|---|
DecryptString | Decrypts a specified string. | |
EncryptString | Encrypts a specified string. | |
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Top
Remarks
When working with data connection strings, Visual Studio tries to keep encrypted data in its encrypted state. In general, the DDEX API represents connection strings as a "display" connection string, which contains no sensitive information, and as an "encrypted" connection string, which is more complete. DDEX uses the methods on this class to encrypt or decrypt these strings.
The encryption algorithm used depends on the current user and machine, and as such a string encrypted using the EncryptString method can only be decrypted by calling the DecryptString method when running as the same user on the same machine.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also
Reference
Microsoft.VisualStudio.Data Namespace
DPAPIProtectedConfigurationProvider