Show / Hide Table of Contents

Class DataProtectionExtensions

Extension methods for System.Security.Cryptography.ProtectedData.

Inheritance
System.Object
DataProtectionExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Microsoft.GNS.Utilities.Extensions
Assembly: Gns.Utilities.dll
Syntax
public static class DataProtectionExtensions

Methods

View Source

Decrypt(String, String, DataProtectionScope)

Decrypts the specified string using the ProtectedData API.

Declaration
public static string Decrypt(this string protectedString, string optionalEntropy = null, DataProtectionScope scope = DataProtectionScope.CurrentUser)
Parameters
Type Name Description
System.String protectedString

The text to decrypt.

System.String optionalEntropy

Optionally used to increase the protection of the encryption.

System.Security.Cryptography.DataProtectionScope scope

Data protection scope (user or local machine).

Returns
Type Description
System.String

The decrypted value.

View Source

Encrypt(String, String, DataProtectionScope)

Encrypts a plain text string value using the ProtectedData API.

Declaration
public static string Encrypt(this string unprotectedString, string optionalEntropy = null, DataProtectionScope scope = DataProtectionScope.CurrentUser)
Parameters
Type Name Description
System.String unprotectedString

The text to encrypt.

System.String optionalEntropy

Optionally used to increase the protection of the encryption.

System.Security.Cryptography.DataProtectionScope scope

Data protection scope (user or local machine).

Returns
Type Description
System.String

The encrypted value.

  • View Source
In This Article
Back to top Generated by DocFX