3 interfaces inheriting from IDataProtector
Microsoft.AspNetCore.DataProtection (1)
IPersistedDataProtector.cs (1)
12public interface IPersistedDataProtector : IDataProtector
Microsoft.AspNetCore.DataProtection.Abstractions (1)
ISpanDataProtector.cs (1)
19public interface ISpanDataProtector : IDataProtector
Microsoft.AspNetCore.DataProtection.Extensions (1)
ITimeLimitedDataProtector.cs (1)
18public interface ITimeLimitedDataProtector : IDataProtector
3 implementations of IDataProtector
Aspire.Dashboard.Tests (1)
LocalBrowserStorageTests.cs (1)
152private sealed class TestDataProtector : IDataProtector
Microsoft.AspNetCore.DataProtection (1)
KeyManagement\KeyRingBasedDataProtector.cs (1)
24internal unsafe class KeyRingBasedDataProtector : IDataProtector, IPersistedDataProtector
Microsoft.AspNetCore.DataProtection.Extensions (1)
DataProtectionAdvancedExtensions.cs (1)
99private sealed class TimeLimitedWrappingProtector : IDataProtector
77 references to IDataProtector
Aspire.Dashboard.Tests (1)
LocalBrowserStorageTests.cs (1)
154public IDataProtector CreateProtector(string purpose)
Microsoft.AspNetCore.Antiforgery (1)
Internal\DefaultAntiforgeryTokenSerializer.cs (1)
18private readonly IDataProtector _defaultCryptoSystem;
Microsoft.AspNetCore.Authentication (9)
PropertiesDataFormat.cs (2)
17/// <param name="protector">The <see cref="IDataProtector"/>.</param> 18public PropertiesDataFormat(IDataProtector protector)
SecureDataFormat.cs (5)
15private readonly IDataProtector _protector; 21/// <param name="protector">The <see cref="IDataProtector"/>.</param> 22public SecureDataFormat(IDataSerializer<TData> serializer, IDataProtector protector) 39var protector = _protector; 71var protector = _protector;
TicketDataFormat.cs (2)
17/// <param name="protector">The <see cref="IDataProtector"/>.</param> 18public TicketDataFormat(IDataProtector protector)
Microsoft.AspNetCore.Authentication.Cookies (1)
PostConfigureCookieAuthenticationOptions.cs (1)
43var dataProtector = options.DataProtectionProvider.CreateProtector("Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationMiddleware", name, "v2");
Microsoft.AspNetCore.Authentication.OAuth (1)
OAuthPostConfigureOptions.cs (1)
46var dataProtector = options.DataProtectionProvider.CreateProtector(
Microsoft.AspNetCore.Components.Endpoints (2)
src\aspnetcore\src\Shared\Components\ProtectedPrerenderComponentApplicationStore.cs (1)
11private IDataProtector _protector = default!; // Assigned in all constructor paths
TempData\CookieTempDataProvider.cs (1)
20private readonly IDataProtector _dataProtector;
Microsoft.AspNetCore.Components.Server (8)
Circuits\CircuitIdFactory.cs (1)
21private readonly IDataProtector _protector;
Circuits\ServerComponentDeserializer.cs (1)
60private readonly IDataProtector _dataProtector;
ProtectedBrowserStorage\ProtectedBrowserStorage.cs (5)
19private readonly ConcurrentDictionary<string, IDataProtector> _cachedDataProtectorsByPurpose 20= new ConcurrentDictionary<string, IDataProtector>(StringComparer.Ordinal); 126var protector = GetOrCreateCachedProtector(purpose); 133var protector = GetOrCreateCachedProtector(purpose); 149private IDataProtector GetOrCreateCachedProtector(string purpose)
src\aspnetcore\src\Shared\Components\ProtectedPrerenderComponentApplicationStore.cs (1)
11private IDataProtector _protector = default!; // Assigned in all constructor paths
Microsoft.AspNetCore.DataProtection (4)
EphemeralDataProtectionProvider.cs (1)
67public IDataProtector CreateProtector(string purpose)
KeyManagement\KeyManagementOptions.cs (1)
36/// to <see cref="IDataProtector.Protect(byte[])"/> may fail. The system may end up
KeyManagement\KeyRingBasedDataProtectionProvider.cs (1)
23public IDataProtector CreateProtector(string purpose)
KeyManagement\KeyRingBasedDataProtector.cs (1)
65public IDataProtector CreateProtector(string purpose)
Microsoft.AspNetCore.DataProtection.Abstractions (29)
DataProtectionCommonExtensions.cs (21)
20/// Creates an <see cref="IDataProtector"/> given a list of purposes. 25/// <returns>An <see cref="IDataProtector"/> tied to the provided purpose chain.</returns> 31public static IDataProtector CreateProtector(this IDataProtectionProvider provider, IEnumerable<string> purposes) 44retVal = retVal.CreateProtector(purpose) ?? CryptoUtil.Fail<IDataProtector>("CreateProtector returned null."); 53Debug.Assert(retVal is IDataProtector); // CreateProtector is supposed to return an instance of this interface 54return (IDataProtector)retVal; 58/// Creates an <see cref="IDataProtector"/> given a list of purposes. 61/// <param name="purpose">The primary purpose used to create the <see cref="IDataProtector"/>.</param> 64/// <returns>An <see cref="IDataProtector"/> tied to the provided purpose chain.</returns> 70public static IDataProtector CreateProtector(this IDataProtectionProvider provider, string purpose, params string[] subPurposes) 79IDataProtector? protector = provider.CreateProtector(purpose); 84return protector ?? CryptoUtil.Fail<IDataProtector>("CreateProtector returned null."); 108/// Retrieves an <see cref="IDataProtector"/> from an <see cref="IServiceProvider"/> given a list of purposes. 114/// <returns>An <see cref="IDataProtector"/> tied to the provided purpose chain.</returns> 120public static IDataProtector GetDataProtector(this IServiceProvider services, IEnumerable<string> purposes) 129/// Retrieves an <see cref="IDataProtector"/> from an <see cref="IServiceProvider"/> given a list of purposes. 133/// <param name="purpose">The primary purpose used to create the <see cref="IDataProtector"/>.</param> 136/// <returns>An <see cref="IDataProtector"/> tied to the provided purpose chain.</returns> 142public static IDataProtector GetDataProtector(this IServiceProvider services, string purpose, params string[] subPurposes) 156public static string Protect(this IDataProtector protector, string plaintext) 183public static string Unprotect(this IDataProtector protector, string protectedData)
IDataProtectionProvider.cs (5)
7/// An interface that can be used to create <see cref="IDataProtector"/> instances. 12/// Creates an <see cref="IDataProtector"/> given a purpose. 15/// The purpose to be assigned to the newly-created <see cref="IDataProtector"/>. 20/// different <see cref="IDataProtector"/> instances created with two different <paramref name="purpose"/> 24IDataProtector CreateProtector(string purpose);
ISpanDataProtector.cs (3)
17/// Is an optimized version of <see cref="IDataProtector"/>. 28/// This method provides an optimized, streaming alternative to <see cref="IDataProtector.Protect(byte[])"/>. 43/// This method provides an optimized, streaming alternative to <see cref="IDataProtector.Unprotect(byte[])"/>.
Microsoft.AspNetCore.DataProtection.Extensions (14)
DataProtectionAdvancedExtensions.cs (4)
65/// Converts an <see cref="IDataProtector"/> into an <see cref="ITimeLimitedDataProtector"/> 68/// <param name="protector">The <see cref="IDataProtector"/> to convert to a time-limited protector.</param> 70public static ITimeLimitedDataProtector ToTimeLimitedDataProtector(this IDataProtector protector) 109public IDataProtector CreateProtector(string purpose)
TimeLimitedDataProtector.cs (10)
14/// Wraps an existing <see cref="IDataProtector"/> and appends a purpose that allows 22private readonly IDataProtector _innerProtector; 23private IDataProtector? _innerProtectorWithTimeLimitedPurpose; // created on-demand 25public TimeLimitedDataProtector(IDataProtector innerProtector) 37private IDataProtector GetInnerProtectorWithTimeLimitedPurpose() 40var retVal = Volatile.Read(ref _innerProtectorWithTimeLimitedPurpose); 43var newValue = _innerProtector.CreateProtector(MyPurposeString); // we always append our purpose to the end of the chain 108IDataProtector IDataProtectionProvider.CreateProtector(string purpose) 115byte[] IDataProtector.Protect(byte[] plaintext) 123byte[] IDataProtector.Unprotect(byte[] protectedData)
Microsoft.AspNetCore.Identity (3)
DataProtectorTokenProvider.cs (3)
46/// Gets the <see cref="IDataProtector"/> for this instance. 49/// The <see cref="IDataProtector"/> for this instance. 51protected IDataProtector Protector { get; private set; }
Microsoft.AspNetCore.Mvc.ViewFeatures (1)
CookieTempDataProvider.cs (1)
25private readonly IDataProtector _dataProtector;
Microsoft.AspNetCore.Session (3)
CookieProtection.cs (2)
12internal static string Protect(IDataProtector protector, string data) 26internal static string Unprotect(IDataProtector protector, string? protectedText, ILogger logger)
SessionMiddleware.cs (1)
25private readonly IDataProtector _dataProtector;