DataProtector Class
This class uses the .NET Core Data Protection APIs to encrypt values. This is the same class used for encryption of authentication data, cookies etc. and this class provides an easy way to encode strings and return encoded strings that can be use for manual cookie processing.
This class is a singleton so there can only be one unique instance per application.
Westwind.AspNetCore.Security.DataProtector
Class Members
Member | Description | |
---|---|---|
![]() |
Constructor | |
![]() ![]() |
GetDataProtector | Internally called to create a Data Protector instance
public IDataProtector GetDataProtector(string uniqueIdentifier, bool force)
|
![]() ![]() |
Protect | Encrypts a string and returns it as a binary BinHex or Base64 string
public string Protect(string dataToProtect, DataProtectionStringEncodingModes stringEncodingMode)
|
![]() ![]() |
UnProtect | Decrypts a previously protected strings from BinHex or Base64 binary dataand returns the orignal string data.
public string UnProtect(string protectedStringData, DataProtectionStringEncodingModes stringEncodingMode)
|
![]() ![]() |
UniqueIdentifier | A unique identifier for this data |
Assembly: Westwind.AspNetCore.dll
© West Wind Technologies, 2025 • Updated: 2025-03-08
Comment or report problem with topic