ITimeLimitedDataProtector Interface

An interface that can provide data protection services where payloads have a finite lifetime.

Namespace
Microsoft.AspNetCore.DataProtection
Assemblies
  • Microsoft.AspNetCore.DataProtection.Extensions

Syntax

public interface ITimeLimitedDataProtector : IDataProtector, IDataProtectionProvider
interface Microsoft.AspNetCore.DataProtection.ITimeLimitedDataProtector

Methods

CreateProtector(System.String)

Creates an Microsoft.AspNetCore.DataProtection.ITimeLimitedDataProtector given a purpose.

Arguments:purpose (System.String) – The purpose to be assigned to the newly-created Microsoft.AspNetCore.DataProtection.ITimeLimitedDataProtector.
Return type:Microsoft.AspNetCore.DataProtection.ITimeLimitedDataProtector
Returns:An Microsoft.AspNetCore.DataProtection.ITimeLimitedDataProtector tied to the provided purpose.
ITimeLimitedDataProtector CreateProtector(string purpose)
Protect(System.Byte[], System.DateTimeOffset)

Cryptographically protects a piece of plaintext data, expiring the data at the chosen time.

Arguments:
  • plaintext (System.Byte<System.Byte>[]) – The plaintext data to protect.
  • expiration (System.DateTimeOffset) – The time when this payload should expire.
Return type:

System.Byte<System.Byte>[]

Returns:

The protected form of the plaintext data.

byte[] Protect(byte[] plaintext, DateTimeOffset expiration)
Unprotect(System.Byte[], out System.DateTimeOffset)

Cryptographically unprotects a piece of protected data.

Arguments:
  • protectedData (System.Byte<System.Byte>[]) – The protected data to unprotect.
  • expiration (System.DateTimeOffset) – An ‘out’ parameter which upon a successful unprotect operation receives the expiration date of the payload.
Return type:

System.Byte<System.Byte>[]

Returns:

The plaintext form of the protected data.

byte[] Unprotect(byte[] protectedData, out DateTimeOffset expiration)