Share via


DataProtection Class

Represents the ability to encrypt and decrypt strings by using the Windows Data Protection API (DPAPI).

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Data.Services.DataProtection

Namespace:  Microsoft.VisualStudio.Data.Services
Assembly:  Microsoft.VisualStudio.Data.Services (in Microsoft.VisualStudio.Data.Services.dll)

Syntax

'Declaration
Public NotInheritable Class DataProtection
public static class DataProtection
public ref class DataProtection abstract sealed
[<AbstractClass>]
[<Sealed>]
type DataProtection =  class end
public final class DataProtection

The DataProtection type exposes the following members.

Methods

  Name Description
Public methodStatic member DecryptString Decrypts a specified string.
Public methodStatic member EncryptString Encrypts a specified string.

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 a connection string as a display connection string, which contains no sensitive information, and as an encrypted connection string, which is more complete. DDEX uses the methods in this class to encrypt or decrypt these strings.

The encryption algorithm used depends on the current user and computer, and as such a string encrypted by using the EncryptString method can only be decrypted by calling the DecryptString method when running as the same user on the same computer.

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.Services Namespace

DPAPIProtectedConfigurationProvider