DataProtectionAdvancedExtensions.Protect Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Protect(ITimeLimitedDataProtector, Byte[], TimeSpan) |
Cryptographically protects a piece of plaintext data, expiring the data after the specified amount of time has elapsed. |
Protect(ITimeLimitedDataProtector, String, DateTimeOffset) |
Cryptographically protects a piece of plaintext data, expiring the data at the chosen time. |
Protect(ITimeLimitedDataProtector, String, TimeSpan) |
Cryptographically protects a piece of plaintext data, expiring the data after the specified amount of time has elapsed. |
Protect(ITimeLimitedDataProtector, Byte[], TimeSpan)
Cryptographically protects a piece of plaintext data, expiring the data after the specified amount of time has elapsed.
public:
[System::Runtime::CompilerServices::Extension]
static cli::array <System::Byte> ^ Protect(Microsoft::AspNetCore::DataProtection::ITimeLimitedDataProtector ^ protector, cli::array <System::Byte> ^ plaintext, TimeSpan lifetime);
public static byte[] Protect (this Microsoft.AspNetCore.DataProtection.ITimeLimitedDataProtector protector, byte[] plaintext, TimeSpan lifetime);
static member Protect : Microsoft.AspNetCore.DataProtection.ITimeLimitedDataProtector * byte[] * TimeSpan -> byte[]
<Extension()>
Public Function Protect (protector As ITimeLimitedDataProtector, plaintext As Byte(), lifetime As TimeSpan) As Byte()
Parameters
- protector
- ITimeLimitedDataProtector
The protector to use.
- plaintext
- Byte[]
The plaintext data to protect.
- lifetime
- TimeSpan
The amount of time after which the payload should no longer be unprotectable.
Returns
The protected form of the plaintext data.
Applies to
Protect(ITimeLimitedDataProtector, String, DateTimeOffset)
Cryptographically protects a piece of plaintext data, expiring the data at the chosen time.
public:
[System::Runtime::CompilerServices::Extension]
static System::String ^ Protect(Microsoft::AspNetCore::DataProtection::ITimeLimitedDataProtector ^ protector, System::String ^ plaintext, DateTimeOffset expiration);
public static string Protect (this Microsoft.AspNetCore.DataProtection.ITimeLimitedDataProtector protector, string plaintext, DateTimeOffset expiration);
static member Protect : Microsoft.AspNetCore.DataProtection.ITimeLimitedDataProtector * string * DateTimeOffset -> string
<Extension()>
Public Function Protect (protector As ITimeLimitedDataProtector, plaintext As String, expiration As DateTimeOffset) As String
Parameters
- protector
- ITimeLimitedDataProtector
The protector to use.
- plaintext
- String
The plaintext data to protect.
- expiration
- DateTimeOffset
The time when this payload should expire.
Returns
The protected form of the plaintext data.
Applies to
Protect(ITimeLimitedDataProtector, String, TimeSpan)
Cryptographically protects a piece of plaintext data, expiring the data after the specified amount of time has elapsed.
public:
[System::Runtime::CompilerServices::Extension]
static System::String ^ Protect(Microsoft::AspNetCore::DataProtection::ITimeLimitedDataProtector ^ protector, System::String ^ plaintext, TimeSpan lifetime);
public static string Protect (this Microsoft.AspNetCore.DataProtection.ITimeLimitedDataProtector protector, string plaintext, TimeSpan lifetime);
static member Protect : Microsoft.AspNetCore.DataProtection.ITimeLimitedDataProtector * string * TimeSpan -> string
<Extension()>
Public Function Protect (protector As ITimeLimitedDataProtector, plaintext As String, lifetime As TimeSpan) As String
Parameters
- protector
- ITimeLimitedDataProtector
The protector to use.
- plaintext
- String
The plaintext data to protect.
- lifetime
- TimeSpan
The amount of time after which the payload should no longer be unprotectable.
Returns
The protected form of the plaintext data.