diff --git a/DataProtection.sln b/DataProtection.sln index f56c09d294..ead0e13a92 100644 --- a/DataProtection.sln +++ b/DataProtection.sln @@ -1,7 +1,6 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26228.4 +VisualStudioVersion = 15.0.26504.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5FCB2DA3-5395-47F5-BCEE-E0EA319448EA}" EndProject @@ -11,6 +10,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{5A3A EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E1D86B1B-41D8-43C9-97FD-C2BF65C414E2}" ProjectSection(SolutionItems) = preProject + build\common.props = build\common.props + build\dependencies.props = build\dependencies.props NuGet.config = NuGet.config EndProjectSection EndProject diff --git a/build/common.props b/build/common.props index 7449c51fe1..b6da5ae4c0 100644 --- a/build/common.props +++ b/build/common.props @@ -16,8 +16,8 @@ - - + + diff --git a/build/dependencies.props b/build/dependencies.props index 11c37b70e3..78d56b807a 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,10 +1,10 @@ 2.0.0-* - 4.3.0 + 4.4.0-* 2.1.0-* 4.7.1 - $(BundledNETStandardPackageVersion) + 2.0.0-* 1.2.3 15.3.0-* 2.3.0-beta2-* diff --git a/samples/AzureBlob/AzureBlob.csproj b/samples/AzureBlob/AzureBlob.csproj index 8ce0a3e6d9..9d6881602f 100644 --- a/samples/AzureBlob/AzureBlob.csproj +++ b/samples/AzureBlob/AzureBlob.csproj @@ -4,8 +4,6 @@ netcoreapp2.0 - Exe - $(PackageTargetFallback);portable-net45+win8+wp8+wpa81 diff --git a/samples/AzureBlob/Program.cs b/samples/AzureBlob/Program.cs index dd1e45b5d9..f0aa1efea5 100644 --- a/samples/AzureBlob/Program.cs +++ b/samples/AzureBlob/Program.cs @@ -31,8 +31,8 @@ namespace AzureBlob .PersistKeysToAzureBlobStorage(container, "keys.xml"); var services = serviceCollection.BuildServiceProvider(); - var loggerFactory = services.GetService(); - loggerFactory.AddConsole(Microsoft.Extensions.Logging.LogLevel.Trace); + var loggerFactory = services.GetService(); + loggerFactory.AddConsole(); // Run a sample payload diff --git a/samples/CustomEncryptorSample/CustomEncryptorSample.csproj b/samples/CustomEncryptorSample/CustomEncryptorSample.csproj index 96ea1517fa..ca8401e36d 100644 --- a/samples/CustomEncryptorSample/CustomEncryptorSample.csproj +++ b/samples/CustomEncryptorSample/CustomEncryptorSample.csproj @@ -3,7 +3,7 @@ - net46;netcoreapp2.0 + net461;netcoreapp2.0 @@ -16,4 +16,8 @@ + + + + diff --git a/samples/CustomEncryptorSample/Program.cs b/samples/CustomEncryptorSample/Program.cs index c79d12c601..89e0f82810 100644 --- a/samples/CustomEncryptorSample/Program.cs +++ b/samples/CustomEncryptorSample/Program.cs @@ -21,11 +21,11 @@ namespace CustomEncryptorSample .UseXmlEncryptor(s => new CustomXmlEncryptor(s)); var services = serviceCollection.BuildServiceProvider(); - var loggerFactory = services.GetRequiredService(); + var loggerFactory = services.GetRequiredService(); loggerFactory.AddConsole(); var protector = services.GetDataProtector("SamplePurpose"); - + // protect the payload var protectedPayload = protector.Protect("Hello World!"); Console.WriteLine($"Protect returned: {protectedPayload}"); diff --git a/samples/KeyManagementSample/KeyManagementSample.csproj b/samples/KeyManagementSample/KeyManagementSample.csproj index dd0a98bd0c..b15e9017a6 100644 --- a/samples/KeyManagementSample/KeyManagementSample.csproj +++ b/samples/KeyManagementSample/KeyManagementSample.csproj @@ -3,7 +3,7 @@ - net46;netcoreapp2.0 + net461;netcoreapp2.0 @@ -11,4 +11,8 @@ + + + + diff --git a/samples/NonDISample/NonDISample.csproj b/samples/NonDISample/NonDISample.csproj index dd0a98bd0c..b15e9017a6 100644 --- a/samples/NonDISample/NonDISample.csproj +++ b/samples/NonDISample/NonDISample.csproj @@ -3,7 +3,7 @@ - net46;netcoreapp2.0 + net461;netcoreapp2.0 @@ -11,4 +11,8 @@ + + + + diff --git a/samples/Redis/Program.cs b/samples/Redis/Program.cs index 94a32c116f..6731c10541 100644 --- a/samples/Redis/Program.cs +++ b/samples/Redis/Program.cs @@ -23,8 +23,8 @@ namespace Redis .PersistKeysToRedis(redis, "DataProtection-Keys"); var services = serviceCollection.BuildServiceProvider(); - var loggerFactory = services.GetService(); - loggerFactory.AddConsole(LogLevel.Trace); + var loggerFactory = services.GetService(); + loggerFactory.AddConsole(); // Run a sample payload var protector = services.GetDataProtector("sample-purpose"); @@ -32,4 +32,4 @@ namespace Redis Console.WriteLine(protectedData); } } -} \ No newline at end of file +} diff --git a/samples/Redis/Redis.csproj b/samples/Redis/Redis.csproj index 6952eb460c..37aecfb68b 100644 --- a/samples/Redis/Redis.csproj +++ b/samples/Redis/Redis.csproj @@ -3,7 +3,7 @@ - netcoreapp2.0;net46 + net461;netcoreapp2.0 @@ -16,4 +16,8 @@ + + + + diff --git a/src/Microsoft.AspNetCore.Cryptography.Internal/CryptoUtil.cs b/src/Microsoft.AspNetCore.Cryptography.Internal/CryptoUtil.cs index 45f405248d..e60673634d 100644 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/CryptoUtil.cs +++ b/src/Microsoft.AspNetCore.Cryptography.Internal/CryptoUtil.cs @@ -4,15 +4,12 @@ using System; using System.Diagnostics; using System.Runtime.CompilerServices; +using System.Runtime.ConstrainedExecution; using System.Runtime.InteropServices; using System.Security.Cryptography; using Microsoft.AspNetCore.Cryptography.Cng; using Microsoft.AspNetCore.Cryptography.Internal; -#if !NETSTANDARD1_3 -using System.Runtime.ConstrainedExecution; -#endif - namespace Microsoft.AspNetCore.Cryptography { internal unsafe static class CryptoUtil @@ -73,12 +70,7 @@ namespace Microsoft.AspNetCore.Cryptography } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] -#if NET46 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif public static bool TimeConstantBuffersAreEqual(byte* bufA, byte* bufB, uint count) { bool areEqual = true; diff --git a/src/Microsoft.AspNetCore.Cryptography.Internal/Microsoft.AspNetCore.Cryptography.Internal.csproj b/src/Microsoft.AspNetCore.Cryptography.Internal/Microsoft.AspNetCore.Cryptography.Internal.csproj index ee4be7ad30..8fe369a218 100644 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/Microsoft.AspNetCore.Cryptography.Internal.csproj +++ b/src/Microsoft.AspNetCore.Cryptography.Internal/Microsoft.AspNetCore.Cryptography.Internal.csproj @@ -4,7 +4,7 @@ Infrastructure for ASP.NET Core cryptographic packages. Applications and libraries should not reference this package directly. - net46;netstandard1.3 + netstandard2.0 $(NoWarn);CS1591 true true diff --git a/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs b/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs deleted file mode 100644 index b61a4c3c44..0000000000 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Runtime.InteropServices; - -#if NETSTANDARD1_3 -namespace Microsoft.Win32.SafeHandles -{ - internal abstract class SafeHandleZeroOrMinusOneIsInvalid : SafeHandle - { - // Called by P/Invoke when returning SafeHandles - protected SafeHandleZeroOrMinusOneIsInvalid(bool ownsHandle) - : base(IntPtr.Zero, ownsHandle) - { - } - - public override bool IsInvalid - { - get - { - return (handle == IntPtr.Zero || handle == (IntPtr)(-1)); - } - } - } -} -#elif NET46 -#else -#error target frameworks need to be updated. -#endif diff --git a/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeLibraryHandle.cs b/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeLibraryHandle.cs index c1ee52202e..ccd0b99c79 100644 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeLibraryHandle.cs +++ b/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeLibraryHandle.cs @@ -2,14 +2,11 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; +using System.Runtime.ConstrainedExecution; using System.Runtime.InteropServices; using System.Security; using Microsoft.Win32.SafeHandles; -#if !NETSTANDARD1_3 -using System.Runtime.ConstrainedExecution; -#endif - namespace Microsoft.AspNetCore.Cryptography.SafeHandles { /// @@ -127,31 +124,11 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles return UnsafeNativeMethods.FreeLibrary(handle); } -#if NET46 [SuppressUnmanagedCodeSecurity] -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif private static class UnsafeNativeMethods { -#if NETSTANDARD1_3 - private const string CORE_LIBRARY_LOADER_LIB = "api-ms-win-core-libraryloader-l1-1-0.dll"; - private const string CORE_LOCALIZATION_LIB = "api-ms-win-core-localization-l1-2-0.dll"; -#elif NET46 - private const string KERNEL32_LIB = "kernel32.dll"; -#else -#error target frameworks need to be updated. -#endif - // http://msdn.microsoft.com/en-us/library/windows/desktop/ms679351(v=vs.85).aspx -#if NETSTANDARD1_3 - [DllImport(CORE_LOCALIZATION_LIB, EntryPoint = "FormatMessageW", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, SetLastError = true)] -#elif NET46 - [DllImport(KERNEL32_LIB, EntryPoint = "FormatMessageW", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, SetLastError = true)] -#else -#error target frameworks need to be updated. -#endif + [DllImport("kernel32.dll", EntryPoint = "FormatMessageW", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, SetLastError = true)] public static extern int FormatMessage( [In] uint dwFlags, [In] SafeLibraryHandle lpSource, @@ -164,50 +141,26 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles // http://msdn.microsoft.com/en-us/library/ms683152(v=vs.85).aspx [return: MarshalAs(UnmanagedType.Bool)] -#if NETSTANDARD1_3 - [DllImport(CORE_LIBRARY_LOADER_LIB, CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode)] -#elif NET46 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - [DllImport(KERNEL32_LIB, CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode)] -#else -#error target frameworks need to be updated. -#endif + [DllImport("kernel32.dll", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode)] internal static extern bool FreeLibrary(IntPtr hModule); // http://msdn.microsoft.com/en-us/library/ms683200(v=vs.85).aspx [return: MarshalAs(UnmanagedType.Bool)] -#if NETSTANDARD1_3 - [DllImport(CORE_LIBRARY_LOADER_LIB, EntryPoint = "GetModuleHandleExW", CallingConvention = CallingConvention.Winapi, SetLastError = true)] -#elif NET46 - [DllImport(KERNEL32_LIB, EntryPoint = "GetModuleHandleExW", CallingConvention = CallingConvention.Winapi, SetLastError = true)] -#else -#error target frameworks need to be updated. -#endif + [DllImport("kernel32.dll", EntryPoint = "GetModuleHandleExW", CallingConvention = CallingConvention.Winapi, SetLastError = true)] internal static extern bool GetModuleHandleEx( [In] uint dwFlags, [In] SafeLibraryHandle lpModuleName, // can point to a location within the module if GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS is set [Out] out IntPtr phModule); // http://msdn.microsoft.com/en-us/library/ms683212(v=vs.85).aspx -#if NETSTANDARD1_3 - [DllImport(CORE_LIBRARY_LOADER_LIB, CallingConvention = CallingConvention.Winapi, SetLastError = true)] -#elif NET46 - [DllImport(KERNEL32_LIB, CallingConvention = CallingConvention.Winapi, SetLastError = true)] -#else -#error target frameworks need to be updated. -#endif + [DllImport("kernel32.dll", CallingConvention = CallingConvention.Winapi, SetLastError = true)] internal static extern IntPtr GetProcAddress( [In] SafeLibraryHandle hModule, [In, MarshalAs(UnmanagedType.LPStr)] string lpProcName); // http://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx -#if NETSTANDARD1_3 - [DllImport(CORE_LIBRARY_LOADER_LIB, EntryPoint = "LoadLibraryExW", CallingConvention = CallingConvention.Winapi, SetLastError = true)] -#elif NET46 - [DllImport(KERNEL32_LIB, EntryPoint = "LoadLibraryExW", CallingConvention = CallingConvention.Winapi, SetLastError = true)] -#else -#error target frameworks need to be updated. -#endif + [DllImport("kernel32.dll", EntryPoint = "LoadLibraryExW", CallingConvention = CallingConvention.Winapi, SetLastError = true)] internal static extern SafeLibraryHandle LoadLibraryEx( [In, MarshalAs(UnmanagedType.LPWStr)] string lpFileName, [In] IntPtr hFile, diff --git a/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SecureLocalAllocHandle.cs b/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SecureLocalAllocHandle.cs index 52399e0f7b..ac1f3c6172 100644 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SecureLocalAllocHandle.cs +++ b/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SecureLocalAllocHandle.cs @@ -3,10 +3,7 @@ using System; using System.Runtime.InteropServices; - -#if !NETSTANDARD1_3 using System.Runtime.ConstrainedExecution; -#endif namespace Microsoft.AspNetCore.Cryptography.SafeHandles { @@ -41,12 +38,7 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles return newHandle; } -#if NET46 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif private void AllocateImpl(IntPtr cb) { handle = Marshal.AllocHGlobal(cb); // actually calls LocalAlloc diff --git a/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeBufferUtil.cs b/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeBufferUtil.cs index 247812f020..681adb8bc3 100644 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeBufferUtil.cs +++ b/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeBufferUtil.cs @@ -3,30 +3,23 @@ using System; using System.Runtime.CompilerServices; +using System.Runtime.ConstrainedExecution; using System.Threading; using Microsoft.AspNetCore.Cryptography.SafeHandles; -#if !NETSTANDARD1_3 -using System.Runtime.ConstrainedExecution; -#endif - namespace Microsoft.AspNetCore.Cryptography { internal unsafe static class UnsafeBufferUtil { [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] -#endif public static void BlockCopy(void* from, void* to, int byteCount) { BlockCopy(from, to, checked((uint)byteCount)); // will be checked before invoking the delegate } [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] -#endif public static void BlockCopy(void* from, void* to, uint byteCount) { if (byteCount != 0) @@ -35,9 +28,7 @@ namespace Microsoft.AspNetCore.Cryptography } } -#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] -#endif public static void BlockCopy(LocalAllocHandle from, void* to, uint byteCount) { bool refAdded = false; @@ -55,9 +46,7 @@ namespace Microsoft.AspNetCore.Cryptography } } -#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] -#endif public static void BlockCopy(void* from, LocalAllocHandle to, uint byteCount) { bool refAdded = false; @@ -75,9 +64,7 @@ namespace Microsoft.AspNetCore.Cryptography } } -#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] -#endif public static void BlockCopy(LocalAllocHandle from, LocalAllocHandle to, IntPtr length) { if (length == IntPtr.Zero) @@ -116,36 +103,20 @@ namespace Microsoft.AspNetCore.Cryptography [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void BlockCopyCore(byte* from, byte* to, uint byteCount) { -#if NETSTANDARD1_3 Buffer.MemoryCopy(from, to, (ulong)byteCount, (ulong)byteCount); -#else - while (byteCount-- != 0) - { - to[byteCount] = from[byteCount]; - } -#endif } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void BlockCopyCore(byte* from, byte* to, ulong byteCount) { -#if NETSTANDARD1_3 Buffer.MemoryCopy(from, to, byteCount, byteCount); -#else - while (byteCount-- != 0) - { - to[byteCount] = from[byteCount]; - } -#endif } /// /// Securely clears a memory buffer. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] -#endif public static void SecureZeroMemory(byte* buffer, int byteCount) { SecureZeroMemory(buffer, checked((uint)byteCount)); @@ -155,9 +126,7 @@ namespace Microsoft.AspNetCore.Cryptography /// Securely clears a memory buffer. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] -#endif public static void SecureZeroMemory(byte* buffer, uint byteCount) { if (byteCount != 0) @@ -176,9 +145,7 @@ namespace Microsoft.AspNetCore.Cryptography /// Securely clears a memory buffer. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] -#endif public static void SecureZeroMemory(byte* buffer, ulong byteCount) { if (byteCount != 0) @@ -196,9 +163,7 @@ namespace Microsoft.AspNetCore.Cryptography /// /// Securely clears a memory buffer. /// -#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] -#endif public static void SecureZeroMemory(byte* buffer, IntPtr length) { if (sizeof(IntPtr) == 4) diff --git a/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeNativeMethods.cs b/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeNativeMethods.cs index c36f78997b..3a5a4d8db3 100644 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeNativeMethods.cs +++ b/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeNativeMethods.cs @@ -4,6 +4,7 @@ using System; using System.Diagnostics; using System.Runtime.CompilerServices; +using System.Runtime.ConstrainedExecution; using System.Runtime.InteropServices; using System.Security; using System.Security.Cryptography; @@ -12,18 +13,9 @@ using Microsoft.AspNetCore.Cryptography.Cng; using Microsoft.AspNetCore.Cryptography.SafeHandles; using Microsoft.Win32.SafeHandles; -#if NET46 -using System.Runtime.ConstrainedExecution; -#endif - namespace Microsoft.AspNetCore.Cryptography { -#if NET46 [SuppressUnmanagedCodeSecurity] -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif internal unsafe static class UnsafeNativeMethods { private const string BCRYPT_LIB = "bcrypt.dll"; @@ -90,23 +82,13 @@ namespace Microsoft.AspNetCore.Cryptography [In] uint dwFlags); [DllImport(BCRYPT_LIB, CallingConvention = CallingConvention.Winapi)] -#if NET46 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif // http://msdn.microsoft.com/en-us/library/windows/desktop/aa375399(v=vs.85).aspx internal static extern int BCryptDestroyHash( [In] IntPtr hHash); [DllImport(BCRYPT_LIB, CallingConvention = CallingConvention.Winapi)] -#if NET46 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif // http://msdn.microsoft.com/en-us/library/windows/desktop/aa375404(v=vs.85).aspx internal static extern int BCryptDestroyKey( [In] IntPtr hKey); @@ -209,7 +191,7 @@ namespace Microsoft.AspNetCore.Cryptography /* * CRYPT32.DLL */ - + [DllImport(CRYPT32_LIB, CallingConvention = CallingConvention.Winapi, SetLastError = true)] // http://msdn.microsoft.com/en-us/library/windows/desktop/aa380261(v=vs.85).aspx internal static extern bool CryptProtectData( @@ -258,12 +240,7 @@ namespace Microsoft.AspNetCore.Cryptography */ [DllImport(NCRYPT_LIB, CallingConvention = CallingConvention.Winapi)] -#if NET46 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif // http://msdn.microsoft.com/en-us/library/windows/desktop/hh706799(v=vs.85).aspx internal static extern int NCryptCloseProtectionDescriptor( [In] IntPtr hDescriptor); diff --git a/src/Microsoft.AspNetCore.Cryptography.Internal/baseline.netframework.json b/src/Microsoft.AspNetCore.Cryptography.Internal/baseline.netframework.json deleted file mode 100644 index 4e3124a689..0000000000 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/baseline.netframework.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "AssemblyIdentity": "Microsoft.AspNetCore.Cryptography.Internal, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60", - "Types": [] -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Cryptography.KeyDerivation/Microsoft.AspNetCore.Cryptography.KeyDerivation.csproj b/src/Microsoft.AspNetCore.Cryptography.KeyDerivation/Microsoft.AspNetCore.Cryptography.KeyDerivation.csproj index 4ff88fbf5e..478845ec47 100644 --- a/src/Microsoft.AspNetCore.Cryptography.KeyDerivation/Microsoft.AspNetCore.Cryptography.KeyDerivation.csproj +++ b/src/Microsoft.AspNetCore.Cryptography.KeyDerivation/Microsoft.AspNetCore.Cryptography.KeyDerivation.csproj @@ -4,8 +4,7 @@ ASP.NET Core utilities for key derivation. - netstandard1.3 - $(NoWarn);CS1591 + netstandard2.0 true true aspnetcore;dataprotection diff --git a/src/Microsoft.AspNetCore.Cryptography.KeyDerivation/baseline.net45.json b/src/Microsoft.AspNetCore.Cryptography.KeyDerivation/baseline.net45.json deleted file mode 100644 index 93e2b1bed7..0000000000 --- a/src/Microsoft.AspNetCore.Cryptography.KeyDerivation/baseline.net45.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "AssemblyIdentity": "Microsoft.AspNetCore.Cryptography.KeyDerivation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60", - "Types": [ - { - "Name": "Microsoft.AspNetCore.Cryptography.KeyDerivation.KeyDerivation", - "Visibility": "Public", - "Kind": "Class", - "Abstract": true, - "Static": true, - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "Pbkdf2", - "Parameters": [ - { - "Name": "password", - "Type": "System.String" - }, - { - "Name": "salt", - "Type": "System.Byte[]" - }, - { - "Name": "prf", - "Type": "Microsoft.AspNetCore.Cryptography.KeyDerivation.KeyDerivationPrf" - }, - { - "Name": "iterationCount", - "Type": "System.Int32" - }, - { - "Name": "numBytesRequested", - "Type": "System.Int32" - } - ], - "ReturnType": "System.Byte[]", - "Static": true, - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.Cryptography.KeyDerivation.KeyDerivationPrf", - "Visibility": "Public", - "Kind": "Enumeration", - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Field", - "Name": "HMACSHA1", - "Parameters": [], - "GenericParameter": [], - "Literal": "0" - }, - { - "Kind": "Field", - "Name": "HMACSHA256", - "Parameters": [], - "GenericParameter": [], - "Literal": "1" - }, - { - "Kind": "Field", - "Name": "HMACSHA512", - "Parameters": [], - "GenericParameter": [], - "Literal": "2" - } - ], - "GenericParameters": [] - } - ] -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.DataProtection.Abstractions/Microsoft.AspNetCore.DataProtection.Abstractions.csproj b/src/Microsoft.AspNetCore.DataProtection.Abstractions/Microsoft.AspNetCore.DataProtection.Abstractions.csproj index 788a8fc77c..936785fab3 100644 --- a/src/Microsoft.AspNetCore.DataProtection.Abstractions/Microsoft.AspNetCore.DataProtection.Abstractions.csproj +++ b/src/Microsoft.AspNetCore.DataProtection.Abstractions/Microsoft.AspNetCore.DataProtection.Abstractions.csproj @@ -7,8 +7,7 @@ Commonly used types: Microsoft.AspNetCore.DataProtection.IDataProtectionProvider Microsoft.AspNetCore.DataProtection.IDataProtector - netstandard1.3 - $(NoWarn);CS1591 + netstandard2.0 true aspnetcore;dataprotection @@ -21,8 +20,4 @@ Microsoft.AspNetCore.DataProtection.IDataProtector - - - - diff --git a/src/Microsoft.AspNetCore.DataProtection.Abstractions/baseline.net45.json b/src/Microsoft.AspNetCore.DataProtection.Abstractions/baseline.net45.json deleted file mode 100644 index 6d0d722ddc..0000000000 --- a/src/Microsoft.AspNetCore.DataProtection.Abstractions/baseline.net45.json +++ /dev/null @@ -1,231 +0,0 @@ -{ - "AssemblyIdentity": "Microsoft.AspNetCore.DataProtection.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60", - "Types": [ - { - "Name": "Microsoft.AspNetCore.DataProtection.DataProtectionCommonExtensions", - "Visibility": "Public", - "Kind": "Class", - "Abstract": true, - "Static": true, - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "CreateProtector", - "Parameters": [ - { - "Name": "provider", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider" - }, - { - "Name": "purposes", - "Type": "System.Collections.Generic.IEnumerable" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtector", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "CreateProtector", - "Parameters": [ - { - "Name": "provider", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider" - }, - { - "Name": "purpose", - "Type": "System.String" - }, - { - "Name": "subPurposes", - "Type": "System.String[]", - "IsParams": true - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtector", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "GetDataProtectionProvider", - "Parameters": [ - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "GetDataProtector", - "Parameters": [ - { - "Name": "services", - "Type": "System.IServiceProvider" - }, - { - "Name": "purposes", - "Type": "System.Collections.Generic.IEnumerable" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtector", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "GetDataProtector", - "Parameters": [ - { - "Name": "services", - "Type": "System.IServiceProvider" - }, - { - "Name": "purpose", - "Type": "System.String" - }, - { - "Name": "subPurposes", - "Type": "System.String[]", - "IsParams": true - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtector", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Protect", - "Parameters": [ - { - "Name": "protector", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtector" - }, - { - "Name": "plaintext", - "Type": "System.String" - } - ], - "ReturnType": "System.String", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Unprotect", - "Parameters": [ - { - "Name": "protector", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtector" - }, - { - "Name": "protectedData", - "Type": "System.String" - } - ], - "ReturnType": "System.String", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "CreateProtector", - "Parameters": [ - { - "Name": "purpose", - "Type": "System.String" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtector", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.IDataProtector", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider" - ], - "Members": [ - { - "Kind": "Method", - "Name": "Protect", - "Parameters": [ - { - "Name": "plaintext", - "Type": "System.Byte[]" - } - ], - "ReturnType": "System.Byte[]", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Unprotect", - "Parameters": [ - { - "Name": "protectedData", - "Type": "System.Byte[]" - } - ], - "ReturnType": "System.Byte[]", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.Infrastructure.IApplicationDiscriminator", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_Discriminator", - "Parameters": [], - "ReturnType": "System.String", - "GenericParameter": [] - } - ], - "GenericParameters": [] - } - ] -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.DataProtection.AzureStorage/AzureBlobXmlRepository.cs b/src/Microsoft.AspNetCore.DataProtection.AzureStorage/AzureBlobXmlRepository.cs index 2b7594e679..e39babaa31 100644 --- a/src/Microsoft.AspNetCore.DataProtection.AzureStorage/AzureBlobXmlRepository.cs +++ b/src/Microsoft.AspNetCore.DataProtection.AzureStorage/AzureBlobXmlRepository.cs @@ -51,6 +51,7 @@ namespace Microsoft.AspNetCore.DataProtection.AzureStorage _random = new Random(); } + /// public IReadOnlyCollection GetAllElements() { var blobRef = CreateFreshBlobRef(); @@ -62,6 +63,7 @@ namespace Microsoft.AspNetCore.DataProtection.AzureStorage return new ReadOnlyCollection(elements); } + /// public void StoreElement(XElement element, string friendlyName) { if (element == null) diff --git a/src/Microsoft.AspNetCore.DataProtection.AzureStorage/Microsoft.AspNetCore.DataProtection.AzureStorage.csproj b/src/Microsoft.AspNetCore.DataProtection.AzureStorage/Microsoft.AspNetCore.DataProtection.AzureStorage.csproj index 1aa0031625..57a9cbc921 100644 --- a/src/Microsoft.AspNetCore.DataProtection.AzureStorage/Microsoft.AspNetCore.DataProtection.AzureStorage.csproj +++ b/src/Microsoft.AspNetCore.DataProtection.AzureStorage/Microsoft.AspNetCore.DataProtection.AzureStorage.csproj @@ -4,9 +4,7 @@ Microsoft Azure Blob storrage support as key store. - 2.0.0 - net46;netstandard1.5 - $(NoWarn);CS1591 + netstandard2.0 true true aspnetcore;dataprotection;azure;blob @@ -14,6 +12,9 @@ + + + diff --git a/src/Microsoft.AspNetCore.DataProtection.Extensions/DataProtectionAdvancedExtensions.cs b/src/Microsoft.AspNetCore.DataProtection.Extensions/DataProtectionAdvancedExtensions.cs index cb452164df..6e4c2aabac 100644 --- a/src/Microsoft.AspNetCore.DataProtection.Extensions/DataProtectionAdvancedExtensions.cs +++ b/src/Microsoft.AspNetCore.DataProtection.Extensions/DataProtectionAdvancedExtensions.cs @@ -5,6 +5,9 @@ using System; namespace Microsoft.AspNetCore.DataProtection { + /// + /// Helpful extension methods for data protection APIs. + /// public static class DataProtectionAdvancedExtensions { /// diff --git a/src/Microsoft.AspNetCore.DataProtection.Extensions/DataProtectionProvider.cs b/src/Microsoft.AspNetCore.DataProtection.Extensions/DataProtectionProvider.cs index 1b9e30a94e..7b080a9a87 100644 --- a/src/Microsoft.AspNetCore.DataProtection.Extensions/DataProtectionProvider.cs +++ b/src/Microsoft.AspNetCore.DataProtection.Extensions/DataProtectionProvider.cs @@ -73,7 +73,6 @@ namespace Microsoft.AspNetCore.DataProtection return CreateProvider(keyDirectory, setupAction, certificate: null); } -#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml /// /// Creates a that store keys in a location based on /// the platform and operating system and uses the given to encrypt the keys. @@ -150,10 +149,6 @@ namespace Microsoft.AspNetCore.DataProtection return CreateProvider(keyDirectory, setupAction, certificate); } -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif private static IDataProtectionProvider CreateProvider( DirectoryInfo keyDirectory, @@ -169,15 +164,10 @@ namespace Microsoft.AspNetCore.DataProtection builder.PersistKeysToFileSystem(keyDirectory); } -#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml if (certificate != null) { builder.ProtectKeysWithCertificate(certificate); } -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif setupAction(builder); @@ -185,4 +175,4 @@ namespace Microsoft.AspNetCore.DataProtection return serviceCollection.BuildServiceProvider().GetRequiredService(); } } -} \ No newline at end of file +} diff --git a/src/Microsoft.AspNetCore.DataProtection.Extensions/Microsoft.AspNetCore.DataProtection.Extensions.csproj b/src/Microsoft.AspNetCore.DataProtection.Extensions/Microsoft.AspNetCore.DataProtection.Extensions.csproj index fe2f163044..c5e139b89b 100644 --- a/src/Microsoft.AspNetCore.DataProtection.Extensions/Microsoft.AspNetCore.DataProtection.Extensions.csproj +++ b/src/Microsoft.AspNetCore.DataProtection.Extensions/Microsoft.AspNetCore.DataProtection.Extensions.csproj @@ -4,8 +4,7 @@ Additional APIs for ASP.NET Core data protection. - net46;netstandard1.3 - $(NoWarn);CS1591 + netstandard2.0 true aspnetcore;dataprotection @@ -16,6 +15,9 @@ + + + diff --git a/src/Microsoft.AspNetCore.DataProtection.Extensions/baseline.netcore.json b/src/Microsoft.AspNetCore.DataProtection.Extensions/baseline.netcore.json index 50b7e9764a..93502e6e6e 100644 --- a/src/Microsoft.AspNetCore.DataProtection.Extensions/baseline.netcore.json +++ b/src/Microsoft.AspNetCore.DataProtection.Extensions/baseline.netcore.json @@ -175,6 +175,64 @@ "Static": true, "Visibility": "Public", "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "Create", + "Parameters": [ + { + "Name": "applicationName", + "Type": "System.String" + }, + { + "Name": "certificate", + "Type": "System.Security.Cryptography.X509Certificates.X509Certificate2" + } + ], + "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider", + "Static": true, + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "Create", + "Parameters": [ + { + "Name": "keyDirectory", + "Type": "System.IO.DirectoryInfo" + }, + { + "Name": "certificate", + "Type": "System.Security.Cryptography.X509Certificates.X509Certificate2" + } + ], + "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider", + "Static": true, + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "Create", + "Parameters": [ + { + "Name": "keyDirectory", + "Type": "System.IO.DirectoryInfo" + }, + { + "Name": "setupAction", + "Type": "System.Action" + }, + { + "Name": "certificate", + "Type": "System.Security.Cryptography.X509Certificates.X509Certificate2" + } + ], + "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider", + "Static": true, + "Visibility": "Public", + "GenericParameter": [] } ], "GenericParameters": [] diff --git a/src/Microsoft.AspNetCore.DataProtection.Extensions/baseline.netframework.json b/src/Microsoft.AspNetCore.DataProtection.Extensions/baseline.netframework.json deleted file mode 100644 index 93502e6e6e..0000000000 --- a/src/Microsoft.AspNetCore.DataProtection.Extensions/baseline.netframework.json +++ /dev/null @@ -1,298 +0,0 @@ -{ - "AssemblyIdentity": "Microsoft.AspNetCore.DataProtection.Extensions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60", - "Types": [ - { - "Name": "Microsoft.AspNetCore.DataProtection.DataProtectionAdvancedExtensions", - "Visibility": "Public", - "Kind": "Class", - "Abstract": true, - "Static": true, - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "Protect", - "Parameters": [ - { - "Name": "protector", - "Type": "Microsoft.AspNetCore.DataProtection.ITimeLimitedDataProtector" - }, - { - "Name": "plaintext", - "Type": "System.Byte[]" - }, - { - "Name": "lifetime", - "Type": "System.TimeSpan" - } - ], - "ReturnType": "System.Byte[]", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Protect", - "Parameters": [ - { - "Name": "protector", - "Type": "Microsoft.AspNetCore.DataProtection.ITimeLimitedDataProtector" - }, - { - "Name": "plaintext", - "Type": "System.String" - }, - { - "Name": "expiration", - "Type": "System.DateTimeOffset" - } - ], - "ReturnType": "System.String", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Protect", - "Parameters": [ - { - "Name": "protector", - "Type": "Microsoft.AspNetCore.DataProtection.ITimeLimitedDataProtector" - }, - { - "Name": "plaintext", - "Type": "System.String" - }, - { - "Name": "lifetime", - "Type": "System.TimeSpan" - } - ], - "ReturnType": "System.String", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ToTimeLimitedDataProtector", - "Parameters": [ - { - "Name": "protector", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtector" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.ITimeLimitedDataProtector", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Unprotect", - "Parameters": [ - { - "Name": "protector", - "Type": "Microsoft.AspNetCore.DataProtection.ITimeLimitedDataProtector" - }, - { - "Name": "protectedData", - "Type": "System.String" - }, - { - "Name": "expiration", - "Type": "System.DateTimeOffset", - "Direction": "Out" - } - ], - "ReturnType": "System.String", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.DataProtectionProvider", - "Visibility": "Public", - "Kind": "Class", - "Abstract": true, - "Static": true, - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "Create", - "Parameters": [ - { - "Name": "applicationName", - "Type": "System.String" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider", - "Static": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Create", - "Parameters": [ - { - "Name": "keyDirectory", - "Type": "System.IO.DirectoryInfo" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider", - "Static": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Create", - "Parameters": [ - { - "Name": "keyDirectory", - "Type": "System.IO.DirectoryInfo" - }, - { - "Name": "setupAction", - "Type": "System.Action" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider", - "Static": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Create", - "Parameters": [ - { - "Name": "applicationName", - "Type": "System.String" - }, - { - "Name": "certificate", - "Type": "System.Security.Cryptography.X509Certificates.X509Certificate2" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider", - "Static": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Create", - "Parameters": [ - { - "Name": "keyDirectory", - "Type": "System.IO.DirectoryInfo" - }, - { - "Name": "certificate", - "Type": "System.Security.Cryptography.X509Certificates.X509Certificate2" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider", - "Static": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Create", - "Parameters": [ - { - "Name": "keyDirectory", - "Type": "System.IO.DirectoryInfo" - }, - { - "Name": "setupAction", - "Type": "System.Action" - }, - { - "Name": "certificate", - "Type": "System.Security.Cryptography.X509Certificates.X509Certificate2" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider", - "Static": true, - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.ITimeLimitedDataProtector", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.IDataProtector" - ], - "Members": [ - { - "Kind": "Method", - "Name": "CreateProtector", - "Parameters": [ - { - "Name": "purpose", - "Type": "System.String" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.ITimeLimitedDataProtector", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Protect", - "Parameters": [ - { - "Name": "plaintext", - "Type": "System.Byte[]" - }, - { - "Name": "expiration", - "Type": "System.DateTimeOffset" - } - ], - "ReturnType": "System.Byte[]", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Unprotect", - "Parameters": [ - { - "Name": "protectedData", - "Type": "System.Byte[]" - }, - { - "Name": "expiration", - "Type": "System.DateTimeOffset", - "Direction": "Out" - } - ], - "ReturnType": "System.Byte[]", - "GenericParameter": [] - } - ], - "GenericParameters": [] - } - ] -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.DataProtection.Redis/Microsoft.AspNetCore.DataProtection.Redis.csproj b/src/Microsoft.AspNetCore.DataProtection.Redis/Microsoft.AspNetCore.DataProtection.Redis.csproj index 65b0d5c216..e5f3a6f620 100644 --- a/src/Microsoft.AspNetCore.DataProtection.Redis/Microsoft.AspNetCore.DataProtection.Redis.csproj +++ b/src/Microsoft.AspNetCore.DataProtection.Redis/Microsoft.AspNetCore.DataProtection.Redis.csproj @@ -5,8 +5,7 @@ Redis storage support as key store. 0.3.0 - net46;netstandard1.5 - $(NoWarn);CS1591 + netstandard2.0 true true aspnetcore;dataprotection;redis @@ -14,6 +13,9 @@ + + + diff --git a/src/Microsoft.AspNetCore.DataProtection.SystemWeb/Microsoft.AspNetCore.DataProtection.SystemWeb.csproj b/src/Microsoft.AspNetCore.DataProtection.SystemWeb/Microsoft.AspNetCore.DataProtection.SystemWeb.csproj index d1ae6aeda7..76f71bd615 100644 --- a/src/Microsoft.AspNetCore.DataProtection.SystemWeb/Microsoft.AspNetCore.DataProtection.SystemWeb.csproj +++ b/src/Microsoft.AspNetCore.DataProtection.SystemWeb/Microsoft.AspNetCore.DataProtection.SystemWeb.csproj @@ -4,7 +4,7 @@ A component to allow the ASP.NET Core data protection stack to work with the ASP.NET 4.x <machineKey> element. - net46 + net461 $(NoWarn);CS1591 true aspnet;aspnetcore;dataprotection @@ -16,9 +16,11 @@ + + + - diff --git a/src/Microsoft.AspNetCore.DataProtection/Cng/DpapiSecretSerializerHelper.cs b/src/Microsoft.AspNetCore.DataProtection/Cng/DpapiSecretSerializerHelper.cs index ea37a1b989..61bbb4f9ea 100644 --- a/src/Microsoft.AspNetCore.DataProtection/Cng/DpapiSecretSerializerHelper.cs +++ b/src/Microsoft.AspNetCore.DataProtection/Cng/DpapiSecretSerializerHelper.cs @@ -78,12 +78,8 @@ namespace Microsoft.AspNetCore.DataProtection.Cng }; var dataOut = default(DATA_BLOB); -#if NET46 RuntimeHelpers.PrepareConstrainedRegions(); -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif + try { var success = UnsafeNativeMethods.CryptProtectData( @@ -171,12 +167,9 @@ namespace Microsoft.AspNetCore.DataProtection.Cng fixed (byte* pbRetVal = retVal) { var handleAcquired = false; -#if NET46 + RuntimeHelpers.PrepareConstrainedRegions(); -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif + try { protectedData.DangerousAddRef(ref handleAcquired); @@ -224,12 +217,8 @@ namespace Microsoft.AspNetCore.DataProtection.Cng }; var dataOut = default(DATA_BLOB); -#if NET46 RuntimeHelpers.PrepareConstrainedRegions(); -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif + try { var success = UnsafeNativeMethods.CryptUnprotectData( @@ -300,12 +289,9 @@ namespace Microsoft.AspNetCore.DataProtection.Cng using (unencryptedPayloadHandle) { var handleAcquired = false; -#if NET46 + RuntimeHelpers.PrepareConstrainedRegions(); -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif + try { unencryptedPayloadHandle.DangerousAddRef(ref handleAcquired); diff --git a/src/Microsoft.AspNetCore.DataProtection/DataProtectionBuilderExtensions.cs b/src/Microsoft.AspNetCore.DataProtection/DataProtectionBuilderExtensions.cs index 6a3a9d459c..0bbb916868 100644 --- a/src/Microsoft.AspNetCore.DataProtection/DataProtectionBuilderExtensions.cs +++ b/src/Microsoft.AspNetCore.DataProtection/DataProtectionBuilderExtensions.cs @@ -4,6 +4,7 @@ using System; using System.ComponentModel; using System.IO; +using System.Security.Cryptography.X509Certificates; using Microsoft.AspNetCore.Cryptography; using Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption; using Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel; @@ -16,10 +17,6 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Microsoft.Win32; -#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml -using System.Security.Cryptography.X509Certificates; -#endif - namespace Microsoft.AspNetCore.DataProtection { /// @@ -249,8 +246,6 @@ namespace Microsoft.AspNetCore.DataProtection return builder; } -#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml - /// /// Configures keys to be encrypted to a given certificate before being persisted to storage. /// @@ -321,10 +316,6 @@ namespace Microsoft.AspNetCore.DataProtection return builder; } -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif /// /// Configures keys to be encrypted with Windows DPAPI before being persisted to @@ -604,4 +595,4 @@ namespace Microsoft.AspNetCore.DataProtection return builder; } } -} \ No newline at end of file +} diff --git a/src/Microsoft.AspNetCore.DataProtection/DataProtectionServiceCollectionExtensions.cs b/src/Microsoft.AspNetCore.DataProtection/DataProtectionServiceCollectionExtensions.cs index 5a64d5e44f..95fef0d55c 100644 --- a/src/Microsoft.AspNetCore.DataProtection/DataProtectionServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNetCore.DataProtection/DataProtectionServiceCollectionExtensions.cs @@ -98,12 +98,7 @@ namespace Microsoft.Extensions.DependencyInjection return dataProtectionProvider; }); -#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml services.TryAddSingleton(); -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif } } } diff --git a/src/Microsoft.AspNetCore.DataProtection/IDataProtectionBuilder.cs b/src/Microsoft.AspNetCore.DataProtection/IDataProtectionBuilder.cs index 619bdfcad4..95c7c61f50 100644 --- a/src/Microsoft.AspNetCore.DataProtection/IDataProtectionBuilder.cs +++ b/src/Microsoft.AspNetCore.DataProtection/IDataProtectionBuilder.cs @@ -7,7 +7,6 @@ using Microsoft.Extensions.DependencyInjection; namespace Microsoft.AspNetCore.DataProtection { -#if NET46 /// /// Provides access to configuration for the data protection system, which allows the /// developer to configure default cryptographic algorithms, key storage locations, @@ -34,33 +33,6 @@ namespace Microsoft.AspNetCore.DataProtection /// contain existing keys that use older algorithms or protection mechanisms. /// /// -#elif NETSTANDARD1_3 - /// - /// Provides access to configuration for the data protection system, which allows the - /// developer to configure default cryptographic algorithms, key storage locations, - /// and the mechanism by which keys are protected at rest. - /// - /// - /// - /// If the developer changes the at-rest key protection mechanism, it is intended that - /// he also change the key storage location, and vice versa. - /// - /// - /// Similarly, when a developer modifies the default protected payload cryptographic - /// algorithms, it is intended that he also select an explitiy key storage location. - /// A call to - /// should therefore generally be paired with a call to , - /// for example. - /// - /// - /// When the default cryptographic algorithms or at-rest key protection mechanisms are - /// changed, they only affect new keys in the repository. The repository may - /// contain existing keys that use older algorithms or protection mechanisms. - /// - /// -#else -#error target frameworks need to be updated. -#endif public interface IDataProtectionBuilder { /// diff --git a/src/Microsoft.AspNetCore.DataProtection/Managed/ManagedAuthenticatedEncryptor.cs b/src/Microsoft.AspNetCore.DataProtection/Managed/ManagedAuthenticatedEncryptor.cs index 89cc875d10..0d93955d75 100644 --- a/src/Microsoft.AspNetCore.DataProtection/Managed/ManagedAuthenticatedEncryptor.cs +++ b/src/Microsoft.AspNetCore.DataProtection/Managed/ManagedAuthenticatedEncryptor.cs @@ -343,14 +343,8 @@ namespace Microsoft.AspNetCore.DataProtection.Managed using (var validationAlgorithm = CreateValidationAlgorithm(validationSubkey)) { -#if NET46 - // As an optimization, avoid duplicating the underlying buffer if we're on desktop CLR. + // As an optimization, avoid duplicating the underlying buffer var underlyingBuffer = outputStream.GetBuffer(); -#elif NETSTANDARD1_3 - var underlyingBuffer = outputStream.ToArray(); -#else -#error target frameworks need to be updated. -#endif var mac = validationAlgorithm.ComputeHash(underlyingBuffer, KEY_MODIFIER_SIZE_IN_BYTES, checked((int)outputStream.Length - KEY_MODIFIER_SIZE_IN_BYTES)); outputStream.Write(mac, 0, mac.Length); diff --git a/src/Microsoft.AspNetCore.DataProtection/Microsoft.AspNetCore.DataProtection.csproj b/src/Microsoft.AspNetCore.DataProtection/Microsoft.AspNetCore.DataProtection.csproj index 79a93e283b..a46c797a51 100644 --- a/src/Microsoft.AspNetCore.DataProtection/Microsoft.AspNetCore.DataProtection.csproj +++ b/src/Microsoft.AspNetCore.DataProtection/Microsoft.AspNetCore.DataProtection.csproj @@ -4,7 +4,7 @@ ASP.NET Core logic to protect and unprotect data, similar to DPAPI. - net46;netstandard1.3 + netstandard2.0 $(NoWarn);CS1591 true true @@ -19,22 +19,14 @@ + + + - - - - - - - - - - - - + diff --git a/src/Microsoft.AspNetCore.DataProtection/Repositories/FileSystemXmlRepository.cs b/src/Microsoft.AspNetCore.DataProtection/Repositories/FileSystemXmlRepository.cs index b88f575a03..ce2bb494ff 100644 --- a/src/Microsoft.AspNetCore.DataProtection/Repositories/FileSystemXmlRepository.cs +++ b/src/Microsoft.AspNetCore.DataProtection/Repositories/FileSystemXmlRepository.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; +using System.Runtime.InteropServices; using System.Xml.Linq; using Microsoft.Extensions.Logging; @@ -37,8 +38,9 @@ namespace Microsoft.AspNetCore.DataProtection.Repositories } /// - /// The default key storage directory, which currently corresponds to - /// "%LOCALAPPDATA%\ASP.NET\DataProtection-Keys". + /// The default key storage directory. + /// On Windows, this currently corresponds to "Environment.SpecialFolder.LocalApplication/ASP.NET/DataProtection-Keys". + /// On Linux and macOS, this currently corresponds to "$HOME/.aspnet/DataProtection-Keys". /// /// /// This property can return null if no suitable default key storage directory can @@ -82,28 +84,23 @@ namespace Microsoft.AspNetCore.DataProtection.Repositories private static DirectoryInfo GetDefaultKeyStorageDirectory() { -#if NET46 - // Environment.GetFolderPath returns null if the user profile isn't loaded. - var folderPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); - if (!String.IsNullOrEmpty(folderPath)) - { - return GetKeyStorageDirectoryFromBaseAppDataPath(folderPath); - } - else - { - return null; - } -#elif NETSTANDARD1_3 - // On core CLR, we need to fall back to environment variables. DirectoryInfo retVal; - var localAppDataPath = Environment.GetEnvironmentVariable("LOCALAPPDATA"); + // Environment.GetFolderPath returns null if the user profile isn't loaded. + var localAppDataFromSystemPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); + var localAppDataFromEnvPath = Environment.GetEnvironmentVariable("LOCALAPPDATA"); var userProfilePath = Environment.GetEnvironmentVariable("USERPROFILE"); var homePath = Environment.GetEnvironmentVariable("HOME"); - if (localAppDataPath != null) + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !string.IsNullOrEmpty(localAppDataFromSystemPath)) { - retVal = GetKeyStorageDirectoryFromBaseAppDataPath(localAppDataPath); + // To preserve backwards-compatibility with 1.x, Environment.SpecialFolder.LocalApplicationData + // cannot take precedence over $LOCALAPPDATA and $HOME/.aspnet on non-Windows platforms + retVal = GetKeyStorageDirectoryFromBaseAppDataPath(localAppDataFromSystemPath); + } + else if (localAppDataFromEnvPath != null) + { + retVal = GetKeyStorageDirectoryFromBaseAppDataPath(localAppDataFromEnvPath); } else if (userProfilePath != null) { @@ -115,6 +112,12 @@ namespace Microsoft.AspNetCore.DataProtection.Repositories // it's a good guess that this is a *NIX machine. Use *NIX conventions for a folder name. retVal = new DirectoryInfo(Path.Combine(homePath, ".aspnet", DataProtectionKeysFolderName)); } + else if (!string.IsNullOrEmpty(localAppDataFromSystemPath)) + { + // Starting in 2.x, non-Windows platforms may use Environment.SpecialFolder.LocalApplicationData + // but only after checking for $LOCALAPPDATA, $USERPROFILE, and $HOME. + retVal = GetKeyStorageDirectoryFromBaseAppDataPath(localAppDataFromSystemPath); + } else { return null; @@ -131,9 +134,6 @@ namespace Microsoft.AspNetCore.DataProtection.Repositories { return null; } -#else -#error target frameworks need to be updated. -#endif } internal static DirectoryInfo GetKeyStorageDirectoryForAzureWebSites() diff --git a/src/Microsoft.AspNetCore.DataProtection/TypeForwardingActivator.cs b/src/Microsoft.AspNetCore.DataProtection/TypeForwardingActivator.cs index 3865adbf37..311d4ed48e 100644 --- a/src/Microsoft.AspNetCore.DataProtection/TypeForwardingActivator.cs +++ b/src/Microsoft.AspNetCore.DataProtection/TypeForwardingActivator.cs @@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.DataProtection private const string OldNamespace = "Microsoft.AspNet.DataProtection"; private const string CurrentNamespace = "Microsoft.AspNetCore.DataProtection"; private readonly ILogger _logger; - private static readonly Regex _versionPattern = new Regex(@",\s?Version=(\d+\.?)(\d+\.?)?(\d+\.?)?(\d+\.?)?", RegexOptions.Compiled, TimeSpan.FromSeconds(2)); + private static readonly Regex _versionPattern = new Regex(@",\s?Version=[0-9]+(\.[0-9]+){0,3}", RegexOptions.Compiled, TimeSpan.FromSeconds(2)); public TypeForwardingActivator(IServiceProvider services) : this(services, DataProtectionProviderFactory.GetDefaultLoggerFactory()) @@ -39,16 +39,11 @@ namespace Microsoft.AspNetCore.DataProtection forwardedTypeName = originalTypeName.Replace(OldNamespace, CurrentNamespace); } -#if NET46 - if (candidate || forwardedTypeName.Contains(CurrentNamespace)) + if (candidate || forwardedTypeName.StartsWith(CurrentNamespace + ".", StringComparison.Ordinal)) { candidate = true; forwardedTypeName = RemoveVersionFromAssemblyName(forwardedTypeName); } -#elif NETSTANDARD1_3 -#else -#error Target framework needs to be updated -#endif if (candidate) { @@ -70,4 +65,4 @@ namespace Microsoft.AspNetCore.DataProtection protected string RemoveVersionFromAssemblyName(string forwardedTypeName) => _versionPattern.Replace(forwardedTypeName, ""); } -} \ No newline at end of file +} diff --git a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateResolver.cs b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateResolver.cs index 3bf578e14a..36ff53a6f3 100644 --- a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateResolver.cs +++ b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateResolver.cs @@ -1,9 +1,8 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml - using System; +using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; namespace Microsoft.AspNetCore.DataProtection.XmlEncryption @@ -40,9 +39,19 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption var store = new X509Store(location); try { - store.Open(OpenFlags.ReadOnly); + store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly); var matchingCerts = store.Certificates.Find(X509FindType.FindByThumbprint, thumbprint, validOnly: true); - return (matchingCerts != null && matchingCerts.Count > 0) ? matchingCerts[0] : null; + return (matchingCerts != null && matchingCerts.Count > 0) + ? matchingCerts[0] + : null; + } + catch (CryptographicException) + { + // Suppress first-chance exceptions when opening the store. + // For example, LocalMachine\My is not supported on Linux yet and will throw on Open(), + // but there isn't a good way to detect this without attempting to open the store. + // See https://github.com/dotnet/corefx/issues/3690. + return null; } finally { @@ -51,7 +60,4 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption } } } -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif + diff --git a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateXmlEncryptor.cs b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateXmlEncryptor.cs index 0cbcf30bae..ee1342df94 100644 --- a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateXmlEncryptor.cs +++ b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateXmlEncryptor.cs @@ -1,8 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml - using System; using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.Xml; @@ -147,7 +145,3 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption } } } -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif diff --git a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/EncryptedXmlDecryptor.core50.cs b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/EncryptedXmlDecryptor.core50.cs deleted file mode 100644 index 36bba2fb81..0000000000 --- a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/EncryptedXmlDecryptor.core50.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if NETSTANDARD1_3 -// [[ISSUE60]] Remove this entire file when Core CLR gets support for EncryptedXml. -// This is just a dummy implementation of the class that always throws. -// The only reason it's here (albeit internal) is to provide a nice error message if key -// material that was generated by Desktop CLR needs to be read by Core CLR. - -using System; -using System.Xml.Linq; -using Microsoft.Extensions.Logging; - -namespace Microsoft.AspNetCore.DataProtection.XmlEncryption -{ - internal sealed class EncryptedXmlDecryptor : IXmlDecryptor - { - private readonly ILogger _logger; - - public EncryptedXmlDecryptor() - : this(services: null) - { - } - - public EncryptedXmlDecryptor(IServiceProvider services) - { - _logger = services.GetLogger(); - } - - public XElement Decrypt(XElement encryptedElement) - { - if (_logger.IsErrorLevelEnabled()) - { - _logger.LogError(Resources.EncryptedXmlDecryptor_DoesNotWorkOnCoreClr); - } - - throw new PlatformNotSupportedException(Resources.EncryptedXmlDecryptor_DoesNotWorkOnCoreClr); - } - } -} -#elif NET46 -#else -#error target frameworks need to be updated. -#endif diff --git a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/EncryptedXmlDecryptor.cs b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/EncryptedXmlDecryptor.cs index bfb70d3283..6bc280900c 100644 --- a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/EncryptedXmlDecryptor.cs +++ b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/EncryptedXmlDecryptor.cs @@ -1,8 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml - using System; using System.Security.Cryptography.Xml; using System.Xml; @@ -73,7 +71,3 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption } } } -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif diff --git a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/ICertificateResolver.cs b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/ICertificateResolver.cs index 78b629fd2f..1be22dfbce 100644 --- a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/ICertificateResolver.cs +++ b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/ICertificateResolver.cs @@ -1,8 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml - using System.Security.Cryptography.X509Certificates; namespace Microsoft.AspNetCore.DataProtection.XmlEncryption @@ -20,7 +18,3 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption X509Certificate2 ResolveCertificate(string thumbprint); } } -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif diff --git a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IInternalCertificateXmlEncryptor.cs b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IInternalCertificateXmlEncryptor.cs index 33761a29ed..ef9fe71648 100644 --- a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IInternalCertificateXmlEncryptor.cs +++ b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IInternalCertificateXmlEncryptor.cs @@ -1,8 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml - using System; using System.Xml; using System.Security.Cryptography.Xml; @@ -17,7 +15,3 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption EncryptedData PerformEncryption(EncryptedXml encryptedXml, XmlElement elementToEncrypt); } } -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif diff --git a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IInternalEncryptedXmlDecryptor.cs b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IInternalEncryptedXmlDecryptor.cs index 74987d8f60..79fc0481ed 100644 --- a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IInternalEncryptedXmlDecryptor.cs +++ b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IInternalEncryptedXmlDecryptor.cs @@ -1,8 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml - using System; using System.Security.Cryptography.Xml; @@ -16,7 +14,3 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption void PerformPreDecryptionSetup(EncryptedXml encryptedXml); } } -#elif NETSTANDARD1_3 -#else -#error target frameworks need to be updated. -#endif diff --git a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/XmlEncryptionExtensions.cs b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/XmlEncryptionExtensions.cs index 59dcfc96e5..74189cfad1 100644 --- a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/XmlEncryptionExtensions.cs +++ b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/XmlEncryptionExtensions.cs @@ -133,7 +133,6 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption var memoryStream = new MemoryStream(DEFAULT_BUFFER_SIZE); element.Save(memoryStream); -#if NET46 var underlyingBuffer = memoryStream.GetBuffer(); fixed (byte* __unused__ = underlyingBuffer) // try to limit this moving around in memory while we allocate { @@ -146,23 +145,6 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption Array.Clear(underlyingBuffer, 0, underlyingBuffer.Length); } } -#elif NETSTANDARD1_3 - ArraySegment underlyingBuffer; - CryptoUtil.Assert(memoryStream.TryGetBuffer(out underlyingBuffer), "Underlying buffer isn't exposable."); - fixed (byte* __unused__ = underlyingBuffer.Array) // try to limit this moving around in memory while we allocate - { - try - { - return new Secret(underlyingBuffer); - } - finally - { - Array.Clear(underlyingBuffer.Array, underlyingBuffer.Offset, underlyingBuffer.Count); - } - } -#else -#error target frameworks need to be updated. -#endif } /// diff --git a/src/Microsoft.AspNetCore.DataProtection/baseline.net45.json b/src/Microsoft.AspNetCore.DataProtection/baseline.net45.json deleted file mode 100644 index 17dd37fc63..0000000000 --- a/src/Microsoft.AspNetCore.DataProtection/baseline.net45.json +++ /dev/null @@ -1,3749 +0,0 @@ -{ - "AssemblyIdentity": "Microsoft.AspNetCore.DataProtection, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60", - "Types": [ - { - "Name": "Microsoft.Extensions.DependencyInjection.DataProtectionServiceCollectionExtensions", - "Visibility": "Public", - "Kind": "Class", - "Abstract": true, - "Static": true, - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "AddDataProtection", - "Parameters": [ - { - "Name": "services", - "Type": "Microsoft.Extensions.DependencyInjection.IServiceCollection" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "AddDataProtection", - "Parameters": [ - { - "Name": "services", - "Type": "Microsoft.Extensions.DependencyInjection.IServiceCollection" - }, - { - "Name": "setupAction", - "Type": "System.Action" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.Extensions.DependencyInjection.DataProtectionServices", - "Visibility": "Public", - "Kind": "Class", - "Abstract": true, - "Static": true, - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "GetDefaultServices", - "Parameters": [], - "ReturnType": "System.Collections.Generic.IEnumerable", - "Static": true, - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.DataProtectionBuilderExtensions", - "Visibility": "Public", - "Kind": "Class", - "Abstract": true, - "Static": true, - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "SetApplicationName", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - }, - { - "Name": "applicationName", - "Type": "System.String" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "AddKeyEscrowSink", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - }, - { - "Name": "sink", - "Type": "Microsoft.AspNetCore.DataProtection.KeyManagement.IKeyEscrowSink" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "AddKeyEscrowSink", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [ - { - "ParameterName": "TImplementation", - "ParameterPosition": 0, - "Class": true, - "BaseTypeOrInterfaces": [ - "Microsoft.AspNetCore.DataProtection.KeyManagement.IKeyEscrowSink" - ] - } - ] - }, - { - "Kind": "Method", - "Name": "AddKeyEscrowSink", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - }, - { - "Name": "factory", - "Type": "System.Func" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "AddKeyManagementOptions", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - }, - { - "Name": "setupAction", - "Type": "System.Action" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "DisableAutomaticKeyGeneration", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "PersistKeysToFileSystem", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - }, - { - "Name": "directory", - "Type": "System.IO.DirectoryInfo" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "PersistKeysToRegistry", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - }, - { - "Name": "registryKey", - "Type": "Microsoft.Win32.RegistryKey" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ProtectKeysWithCertificate", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - }, - { - "Name": "certificate", - "Type": "System.Security.Cryptography.X509Certificates.X509Certificate2" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ProtectKeysWithCertificate", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - }, - { - "Name": "thumbprint", - "Type": "System.String" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ProtectKeysWithDpapi", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ProtectKeysWithDpapi", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - }, - { - "Name": "protectToLocalMachine", - "Type": "System.Boolean" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ProtectKeysWithDpapiNG", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ProtectKeysWithDpapiNG", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - }, - { - "Name": "protectionDescriptorRule", - "Type": "System.String" - }, - { - "Name": "flags", - "Type": "Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiNGProtectionDescriptorFlags" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "SetDefaultKeyLifetime", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - }, - { - "Name": "lifetime", - "Type": "System.TimeSpan" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "UseCryptographicAlgorithms", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - }, - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.AuthenticatedEncryptionSettings" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "UseCustomCryptographicAlgorithms", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - }, - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngCbcAuthenticatedEncryptionSettings" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "UseCustomCryptographicAlgorithms", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - }, - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngGcmAuthenticatedEncryptionSettings" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "UseCustomCryptographicAlgorithms", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - }, - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ManagedAuthenticatedEncryptionSettings" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "UseEphemeralDataProtectionProvider", - "Parameters": [ - { - "Name": "builder", - "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.DataProtectionOptions", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_ApplicationDiscriminator", - "Parameters": [], - "ReturnType": "System.String", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_ApplicationDiscriminator", - "Parameters": [ - { - "Name": "value", - "Type": "System.String" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.DataProtectionUtilityExtensions", - "Visibility": "Public", - "Kind": "Class", - "Abstract": true, - "Static": true, - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "GetApplicationUniqueIdentifier", - "Parameters": [ - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "ReturnType": "System.String", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.EphemeralDataProtectionProvider", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider" - ], - "Members": [ - { - "Kind": "Method", - "Name": "CreateProtector", - "Parameters": [ - { - "Name": "purpose", - "Type": "System.String" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtector", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_Services", - "Parameters": [], - "ReturnType": "Microsoft.Extensions.DependencyInjection.IServiceCollection", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.IPersistedDataProtector", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.IDataProtector" - ], - "Members": [ - { - "Kind": "Method", - "Name": "DangerousUnprotect", - "Parameters": [ - { - "Name": "protectedData", - "Type": "System.Byte[]" - }, - { - "Name": "ignoreRevocationErrors", - "Type": "System.Boolean" - }, - { - "Name": "requiresMigration", - "Type": "System.Boolean", - "Direction": "Out" - }, - { - "Name": "wasRevoked", - "Type": "System.Boolean", - "Direction": "Out" - } - ], - "ReturnType": "System.Byte[]", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.ISecret", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [ - "System.IDisposable" - ], - "Members": [ - { - "Kind": "Method", - "Name": "get_Length", - "Parameters": [], - "ReturnType": "System.Int32", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "WriteSecretIntoBuffer", - "Parameters": [ - { - "Name": "buffer", - "Type": "System.ArraySegment" - } - ], - "ReturnType": "System.Void", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.Secret", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.ISecret" - ], - "Members": [ - { - "Kind": "Method", - "Name": "get_Length", - "Parameters": [], - "ReturnType": "System.Int32", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.ISecret", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Dispose", - "Parameters": [], - "ReturnType": "System.Void", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "System.IDisposable", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Random", - "Parameters": [ - { - "Name": "numBytes", - "Type": "System.Int32" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.Secret", - "Static": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "WriteSecretIntoBuffer", - "Parameters": [ - { - "Name": "buffer", - "Type": "System.ArraySegment" - } - ], - "ReturnType": "System.Void", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.ISecret", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "WriteSecretIntoBuffer", - "Parameters": [ - { - "Name": "buffer", - "Type": "System.Byte*" - }, - { - "Name": "bufferLength", - "Type": "System.Int32" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "value", - "Type": "System.ArraySegment" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "value", - "Type": "System.Byte[]" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "secret", - "Type": "System.Byte*" - }, - { - "Name": "secretLength", - "Type": "System.Int32" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "secret", - "Type": "Microsoft.AspNetCore.DataProtection.ISecret" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.CertificateResolver", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.XmlEncryption.ICertificateResolver" - ], - "Members": [ - { - "Kind": "Method", - "Name": "ResolveCertificate", - "Parameters": [ - { - "Name": "thumbprint", - "Type": "System.String" - } - ], - "ReturnType": "System.Security.Cryptography.X509Certificates.X509Certificate2", - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.XmlEncryption.ICertificateResolver", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.CertificateXmlEncryptor", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.XmlEncryption.IInternalCertificateXmlEncryptor", - "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlEncryptor" - ], - "Members": [ - { - "Kind": "Method", - "Name": "Encrypt", - "Parameters": [ - { - "Name": "plaintextElement", - "Type": "System.Xml.Linq.XElement" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.XmlEncryption.EncryptedXmlInfo", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlEncryptor", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "thumbprint", - "Type": "System.String" - }, - { - "Name": "certificateResolver", - "Type": "Microsoft.AspNetCore.DataProtection.XmlEncryption.ICertificateResolver" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "thumbprint", - "Type": "System.String" - }, - { - "Name": "certificateResolver", - "Type": "Microsoft.AspNetCore.DataProtection.XmlEncryption.ICertificateResolver" - }, - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "certificate", - "Type": "System.Security.Cryptography.X509Certificates.X509Certificate2" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "certificate", - "Type": "System.Security.Cryptography.X509Certificates.X509Certificate2" - }, - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiNGProtectionDescriptorFlags", - "Visibility": "Public", - "Kind": "Enumeration", - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Field", - "Name": "None", - "Parameters": [], - "GenericParameter": [], - "Literal": "0" - }, - { - "Kind": "Field", - "Name": "NamedDescriptor", - "Parameters": [], - "GenericParameter": [], - "Literal": "1" - }, - { - "Kind": "Field", - "Name": "MachineKey", - "Parameters": [], - "GenericParameter": [], - "Literal": "32" - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiNGXmlDecryptor", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlDecryptor" - ], - "Members": [ - { - "Kind": "Method", - "Name": "Decrypt", - "Parameters": [ - { - "Name": "encryptedElement", - "Type": "System.Xml.Linq.XElement" - } - ], - "ReturnType": "System.Xml.Linq.XElement", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlDecryptor", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiNGXmlEncryptor", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlEncryptor" - ], - "Members": [ - { - "Kind": "Method", - "Name": "Encrypt", - "Parameters": [ - { - "Name": "plaintextElement", - "Type": "System.Xml.Linq.XElement" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.XmlEncryption.EncryptedXmlInfo", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlEncryptor", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "protectionDescriptorRule", - "Type": "System.String" - }, - { - "Name": "flags", - "Type": "Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiNGProtectionDescriptorFlags" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "protectionDescriptorRule", - "Type": "System.String" - }, - { - "Name": "flags", - "Type": "Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiNGProtectionDescriptorFlags" - }, - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiXmlDecryptor", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlDecryptor" - ], - "Members": [ - { - "Kind": "Method", - "Name": "Decrypt", - "Parameters": [ - { - "Name": "encryptedElement", - "Type": "System.Xml.Linq.XElement" - } - ], - "ReturnType": "System.Xml.Linq.XElement", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlDecryptor", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiXmlEncryptor", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlEncryptor" - ], - "Members": [ - { - "Kind": "Method", - "Name": "Encrypt", - "Parameters": [ - { - "Name": "plaintextElement", - "Type": "System.Xml.Linq.XElement" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.XmlEncryption.EncryptedXmlInfo", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlEncryptor", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "protectToLocalMachine", - "Type": "System.Boolean" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "protectToLocalMachine", - "Type": "System.Boolean" - }, - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.EncryptedXmlDecryptor", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.XmlEncryption.IInternalEncryptedXmlDecryptor", - "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlDecryptor" - ], - "Members": [ - { - "Kind": "Method", - "Name": "Decrypt", - "Parameters": [ - { - "Name": "encryptedElement", - "Type": "System.Xml.Linq.XElement" - } - ], - "ReturnType": "System.Xml.Linq.XElement", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlDecryptor", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.EncryptedXmlInfo", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_DecryptorType", - "Parameters": [], - "ReturnType": "System.Type", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_EncryptedElement", - "Parameters": [], - "ReturnType": "System.Xml.Linq.XElement", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "encryptedElement", - "Type": "System.Xml.Linq.XElement" - }, - { - "Name": "decryptorType", - "Type": "System.Type" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.ICertificateResolver", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "ResolveCertificate", - "Parameters": [ - { - "Name": "thumbprint", - "Type": "System.String" - } - ], - "ReturnType": "System.Security.Cryptography.X509Certificates.X509Certificate2", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlDecryptor", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "Decrypt", - "Parameters": [ - { - "Name": "encryptedElement", - "Type": "System.Xml.Linq.XElement" - } - ], - "ReturnType": "System.Xml.Linq.XElement", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlEncryptor", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "Encrypt", - "Parameters": [ - { - "Name": "plaintextElement", - "Type": "System.Xml.Linq.XElement" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.XmlEncryption.EncryptedXmlInfo", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.NullXmlDecryptor", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlDecryptor" - ], - "Members": [ - { - "Kind": "Method", - "Name": "Decrypt", - "Parameters": [ - { - "Name": "encryptedElement", - "Type": "System.Xml.Linq.XElement" - } - ], - "ReturnType": "System.Xml.Linq.XElement", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlDecryptor", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.NullXmlEncryptor", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlEncryptor" - ], - "Members": [ - { - "Kind": "Method", - "Name": "Encrypt", - "Parameters": [ - { - "Name": "plaintextElement", - "Type": "System.Xml.Linq.XElement" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.XmlEncryption.EncryptedXmlInfo", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlEncryptor", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.Repositories.IXmlRepository" - ], - "Members": [ - { - "Kind": "Method", - "Name": "get_DefaultKeyStorageDirectory", - "Parameters": [], - "ReturnType": "System.IO.DirectoryInfo", - "Static": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_Directory", - "Parameters": [], - "ReturnType": "System.IO.DirectoryInfo", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_Services", - "Parameters": [], - "ReturnType": "System.IServiceProvider", - "Visibility": "Protected", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "GetAllElements", - "Parameters": [], - "ReturnType": "System.Collections.Generic.IReadOnlyCollection", - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.Repositories.IXmlRepository", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "StoreElement", - "Parameters": [ - { - "Name": "element", - "Type": "System.Xml.Linq.XElement" - }, - { - "Name": "friendlyName", - "Type": "System.String" - } - ], - "ReturnType": "System.Void", - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.Repositories.IXmlRepository", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "directory", - "Type": "System.IO.DirectoryInfo" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "directory", - "Type": "System.IO.DirectoryInfo" - }, - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.Repositories.IXmlRepository", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "GetAllElements", - "Parameters": [], - "ReturnType": "System.Collections.Generic.IReadOnlyCollection", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "StoreElement", - "Parameters": [ - { - "Name": "element", - "Type": "System.Xml.Linq.XElement" - }, - { - "Name": "friendlyName", - "Type": "System.String" - } - ], - "ReturnType": "System.Void", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.Repositories.RegistryXmlRepository", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.Repositories.IXmlRepository" - ], - "Members": [ - { - "Kind": "Method", - "Name": "get_DefaultRegistryKey", - "Parameters": [], - "ReturnType": "Microsoft.Win32.RegistryKey", - "Static": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_RegistryKey", - "Parameters": [], - "ReturnType": "Microsoft.Win32.RegistryKey", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_Services", - "Parameters": [], - "ReturnType": "System.IServiceProvider", - "Visibility": "Protected", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "GetAllElements", - "Parameters": [], - "ReturnType": "System.Collections.Generic.IReadOnlyCollection", - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.Repositories.IXmlRepository", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "StoreElement", - "Parameters": [ - { - "Name": "element", - "Type": "System.Xml.Linq.XElement" - }, - { - "Name": "friendlyName", - "Type": "System.String" - } - ], - "ReturnType": "System.Void", - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.Repositories.IXmlRepository", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "registryKey", - "Type": "Microsoft.Win32.RegistryKey" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "registryKey", - "Type": "Microsoft.Win32.RegistryKey" - }, - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.KeyManagement.IKey", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_ActivationDate", - "Parameters": [], - "ReturnType": "System.DateTimeOffset", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_CreationDate", - "Parameters": [], - "ReturnType": "System.DateTimeOffset", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_ExpirationDate", - "Parameters": [], - "ReturnType": "System.DateTimeOffset", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_IsRevoked", - "Parameters": [], - "ReturnType": "System.Boolean", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_KeyId", - "Parameters": [], - "ReturnType": "System.Guid", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "CreateEncryptorInstance", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryptor", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.KeyManagement.IKeyEscrowSink", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "Store", - "Parameters": [ - { - "Name": "keyId", - "Type": "System.Guid" - }, - { - "Name": "element", - "Type": "System.Xml.Linq.XElement" - } - ], - "ReturnType": "System.Void", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.KeyManagement.IKeyManager", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "CreateNewKey", - "Parameters": [ - { - "Name": "activationDate", - "Type": "System.DateTimeOffset" - }, - { - "Name": "expirationDate", - "Type": "System.DateTimeOffset" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.KeyManagement.IKey", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "GetAllKeys", - "Parameters": [], - "ReturnType": "System.Collections.Generic.IReadOnlyCollection", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "GetCacheExpirationToken", - "Parameters": [], - "ReturnType": "System.Threading.CancellationToken", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "RevokeKey", - "Parameters": [ - { - "Name": "keyId", - "Type": "System.Guid" - }, - { - "Name": "reason", - "Type": "System.String", - "DefaultValue": "null" - } - ], - "ReturnType": "System.Void", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "RevokeAllKeys", - "Parameters": [ - { - "Name": "revocationDate", - "Type": "System.DateTimeOffset" - }, - { - "Name": "reason", - "Type": "System.String", - "DefaultValue": "null" - } - ], - "ReturnType": "System.Void", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.KeyManagement.KeyManagementOptions", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_AutoGenerateKeys", - "Parameters": [], - "ReturnType": "System.Boolean", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_AutoGenerateKeys", - "Parameters": [ - { - "Name": "value", - "Type": "System.Boolean" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_NewKeyLifetime", - "Parameters": [], - "ReturnType": "System.TimeSpan", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_NewKeyLifetime", - "Parameters": [ - { - "Name": "value", - "Type": "System.TimeSpan" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.KeyManagement.IKeyManager", - "Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.IInternalXmlKeyManager" - ], - "Members": [ - { - "Kind": "Method", - "Name": "CreateNewKey", - "Parameters": [ - { - "Name": "activationDate", - "Type": "System.DateTimeOffset" - }, - { - "Name": "expirationDate", - "Type": "System.DateTimeOffset" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.KeyManagement.IKey", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.KeyManagement.IKeyManager", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "GetAllKeys", - "Parameters": [], - "ReturnType": "System.Collections.Generic.IReadOnlyCollection", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.KeyManagement.IKeyManager", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "GetCacheExpirationToken", - "Parameters": [], - "ReturnType": "System.Threading.CancellationToken", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.KeyManagement.IKeyManager", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "RevokeAllKeys", - "Parameters": [ - { - "Name": "revocationDate", - "Type": "System.DateTimeOffset" - }, - { - "Name": "reason", - "Type": "System.String", - "DefaultValue": "null" - } - ], - "ReturnType": "System.Void", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.KeyManagement.IKeyManager", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "RevokeKey", - "Parameters": [ - { - "Name": "keyId", - "Type": "System.Guid" - }, - { - "Name": "reason", - "Type": "System.String", - "DefaultValue": "null" - } - ], - "ReturnType": "System.Void", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.KeyManagement.IKeyManager", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "repository", - "Type": "Microsoft.AspNetCore.DataProtection.Repositories.IXmlRepository" - }, - { - "Name": "configuration", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorConfiguration" - }, - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.CacheableKeyRing", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.DefaultKeyResolution", - "Visibility": "Public", - "Kind": "Struct", - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Field", - "Name": "DefaultKey", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.KeyManagement.IKey", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Field", - "Name": "FallbackKey", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.KeyManagement.IKey", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Field", - "Name": "ShouldGenerateNewKey", - "Parameters": [], - "ReturnType": "System.Boolean", - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.ICacheableKeyRingProvider", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "GetCacheableKeyRing", - "Parameters": [ - { - "Name": "now", - "Type": "System.DateTimeOffset" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.CacheableKeyRing", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.IDefaultKeyResolver", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "ResolveDefaultKeyPolicy", - "Parameters": [ - { - "Name": "now", - "Type": "System.DateTimeOffset" - }, - { - "Name": "allKeys", - "Type": "System.Collections.Generic.IEnumerable" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.DefaultKeyResolution", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.IDefaultKeyServices", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "GetKeyEncryptor", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlEncryptor", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "GetKeyRepository", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.Repositories.IXmlRepository", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.IInternalXmlKeyManager", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "CreateNewKey", - "Parameters": [ - { - "Name": "keyId", - "Type": "System.Guid" - }, - { - "Name": "creationDate", - "Type": "System.DateTimeOffset" - }, - { - "Name": "activationDate", - "Type": "System.DateTimeOffset" - }, - { - "Name": "expirationDate", - "Type": "System.DateTimeOffset" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.KeyManagement.IKey", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "DeserializeDescriptorFromKeyElement", - "Parameters": [ - { - "Name": "keyElement", - "Type": "System.Xml.Linq.XElement" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "RevokeSingleKey", - "Parameters": [ - { - "Name": "keyId", - "Type": "System.Guid" - }, - { - "Name": "revocationDate", - "Type": "System.DateTimeOffset" - }, - { - "Name": "reason", - "Type": "System.String" - } - ], - "ReturnType": "System.Void", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.IKeyRing", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_DefaultAuthenticatedEncryptor", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryptor", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_DefaultKeyId", - "Parameters": [], - "ReturnType": "System.Guid", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "GetAuthenticatedEncryptorByKeyId", - "Parameters": [ - { - "Name": "keyId", - "Type": "System.Guid" - }, - { - "Name": "isRevoked", - "Type": "System.Boolean", - "Direction": "Out" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryptor", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.IKeyRingProvider", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "GetCurrentKeyRing", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.IKeyRing", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.Internal.DataProtectionBuilder", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" - ], - "Members": [ - { - "Kind": "Method", - "Name": "get_Services", - "Parameters": [], - "ReturnType": "Microsoft.Extensions.DependencyInjection.IServiceCollection", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "services", - "Type": "Microsoft.Extensions.DependencyInjection.IServiceCollection" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.Internal.IActivator", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "CreateInstance", - "Parameters": [ - { - "Name": "expectedBaseType", - "Type": "System.Type" - }, - { - "Name": "implementationTypeName", - "Type": "System.String" - } - ], - "ReturnType": "System.Object", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.Cng.Internal.CngAuthenticatedEncryptorBase", - "Visibility": "Public", - "Kind": "Class", - "Abstract": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IOptimizedAuthenticatedEncryptor", - "System.IDisposable" - ], - "Members": [ - { - "Kind": "Method", - "Name": "Decrypt", - "Parameters": [ - { - "Name": "ciphertext", - "Type": "System.ArraySegment" - }, - { - "Name": "additionalAuthenticatedData", - "Type": "System.ArraySegment" - } - ], - "ReturnType": "System.Byte[]", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryptor", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "DecryptImpl", - "Parameters": [ - { - "Name": "pbCiphertext", - "Type": "System.Byte*" - }, - { - "Name": "cbCiphertext", - "Type": "System.UInt32" - }, - { - "Name": "pbAdditionalAuthenticatedData", - "Type": "System.Byte*" - }, - { - "Name": "cbAdditionalAuthenticatedData", - "Type": "System.UInt32" - } - ], - "ReturnType": "System.Byte[]", - "Virtual": true, - "Abstract": true, - "Visibility": "Protected", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Dispose", - "Parameters": [], - "ReturnType": "System.Void", - "Virtual": true, - "Abstract": true, - "ImplementedInterface": "System.IDisposable", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Encrypt", - "Parameters": [ - { - "Name": "plaintext", - "Type": "System.ArraySegment" - }, - { - "Name": "additionalAuthenticatedData", - "Type": "System.ArraySegment" - } - ], - "ReturnType": "System.Byte[]", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryptor", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Encrypt", - "Parameters": [ - { - "Name": "plaintext", - "Type": "System.ArraySegment" - }, - { - "Name": "additionalAuthenticatedData", - "Type": "System.ArraySegment" - }, - { - "Name": "preBufferSize", - "Type": "System.UInt32" - }, - { - "Name": "postBufferSize", - "Type": "System.UInt32" - } - ], - "ReturnType": "System.Byte[]", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IOptimizedAuthenticatedEncryptor", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "EncryptImpl", - "Parameters": [ - { - "Name": "pbPlaintext", - "Type": "System.Byte*" - }, - { - "Name": "cbPlaintext", - "Type": "System.UInt32" - }, - { - "Name": "pbAdditionalAuthenticatedData", - "Type": "System.Byte*" - }, - { - "Name": "cbAdditionalAuthenticatedData", - "Type": "System.UInt32" - }, - { - "Name": "cbPreBuffer", - "Type": "System.UInt32" - }, - { - "Name": "cbPostBuffer", - "Type": "System.UInt32" - } - ], - "ReturnType": "System.Byte[]", - "Virtual": true, - "Abstract": true, - "Visibility": "Protected", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Protected", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.AuthenticatedEncryptionSettings", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IInternalAuthenticatedEncryptionSettings" - ], - "Members": [ - { - "Kind": "Method", - "Name": "get_EncryptionAlgorithm", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.EncryptionAlgorithm", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_EncryptionAlgorithm", - "Parameters": [ - { - "Name": "value", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.EncryptionAlgorithm" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_ValidationAlgorithm", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ValidationAlgorithm", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_ValidationAlgorithm", - "Parameters": [ - { - "Name": "value", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ValidationAlgorithm" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Validate", - "Parameters": [], - "ReturnType": "System.Void", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IInternalAuthenticatedEncryptionSettings", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngCbcAuthenticatedEncryptionSettings", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IInternalAuthenticatedEncryptionSettings" - ], - "Members": [ - { - "Kind": "Method", - "Name": "get_EncryptionAlgorithm", - "Parameters": [], - "ReturnType": "System.String", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_EncryptionAlgorithm", - "Parameters": [ - { - "Name": "value", - "Type": "System.String" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_EncryptionAlgorithmProvider", - "Parameters": [], - "ReturnType": "System.String", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_EncryptionAlgorithmProvider", - "Parameters": [ - { - "Name": "value", - "Type": "System.String" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_EncryptionAlgorithmKeySize", - "Parameters": [], - "ReturnType": "System.Int32", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_EncryptionAlgorithmKeySize", - "Parameters": [ - { - "Name": "value", - "Type": "System.Int32" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_HashAlgorithm", - "Parameters": [], - "ReturnType": "System.String", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_HashAlgorithm", - "Parameters": [ - { - "Name": "value", - "Type": "System.String" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_HashAlgorithmProvider", - "Parameters": [], - "ReturnType": "System.String", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_HashAlgorithmProvider", - "Parameters": [ - { - "Name": "value", - "Type": "System.String" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Validate", - "Parameters": [], - "ReturnType": "System.Void", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IInternalAuthenticatedEncryptionSettings", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngGcmAuthenticatedEncryptionSettings", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IInternalAuthenticatedEncryptionSettings" - ], - "Members": [ - { - "Kind": "Method", - "Name": "get_EncryptionAlgorithm", - "Parameters": [], - "ReturnType": "System.String", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_EncryptionAlgorithm", - "Parameters": [ - { - "Name": "value", - "Type": "System.String" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_EncryptionAlgorithmProvider", - "Parameters": [], - "ReturnType": "System.String", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_EncryptionAlgorithmProvider", - "Parameters": [ - { - "Name": "value", - "Type": "System.String" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_EncryptionAlgorithmKeySize", - "Parameters": [], - "ReturnType": "System.Int32", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_EncryptionAlgorithmKeySize", - "Parameters": [ - { - "Name": "value", - "Type": "System.Int32" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Validate", - "Parameters": [], - "ReturnType": "System.Void", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IInternalAuthenticatedEncryptionSettings", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.EncryptionAlgorithm", - "Visibility": "Public", - "Kind": "Enumeration", - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Field", - "Name": "AES_128_CBC", - "Parameters": [], - "GenericParameter": [], - "Literal": "0" - }, - { - "Kind": "Field", - "Name": "AES_192_CBC", - "Parameters": [], - "GenericParameter": [], - "Literal": "1" - }, - { - "Kind": "Field", - "Name": "AES_256_CBC", - "Parameters": [], - "GenericParameter": [], - "Literal": "2" - }, - { - "Kind": "Field", - "Name": "AES_128_GCM", - "Parameters": [], - "GenericParameter": [], - "Literal": "3" - }, - { - "Kind": "Field", - "Name": "AES_192_GCM", - "Parameters": [], - "GenericParameter": [], - "Literal": "4" - }, - { - "Kind": "Field", - "Name": "AES_256_GCM", - "Parameters": [], - "GenericParameter": [], - "Literal": "5" - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryptor", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "Decrypt", - "Parameters": [ - { - "Name": "ciphertext", - "Type": "System.ArraySegment" - }, - { - "Name": "additionalAuthenticatedData", - "Type": "System.ArraySegment" - } - ], - "ReturnType": "System.Byte[]", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Encrypt", - "Parameters": [ - { - "Name": "plaintext", - "Type": "System.ArraySegment" - }, - { - "Name": "additionalAuthenticatedData", - "Type": "System.ArraySegment" - } - ], - "ReturnType": "System.Byte[]", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ManagedAuthenticatedEncryptionSettings", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IInternalAuthenticatedEncryptionSettings" - ], - "Members": [ - { - "Kind": "Method", - "Name": "get_EncryptionAlgorithmType", - "Parameters": [], - "ReturnType": "System.Type", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_EncryptionAlgorithmType", - "Parameters": [ - { - "Name": "value", - "Type": "System.Type" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_EncryptionAlgorithmKeySize", - "Parameters": [], - "ReturnType": "System.Int32", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_EncryptionAlgorithmKeySize", - "Parameters": [ - { - "Name": "value", - "Type": "System.Int32" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_ValidationAlgorithmType", - "Parameters": [], - "ReturnType": "System.Type", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "set_ValidationAlgorithmType", - "Parameters": [ - { - "Name": "value", - "Type": "System.Type" - } - ], - "ReturnType": "System.Void", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "Validate", - "Parameters": [], - "ReturnType": "System.Void", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IInternalAuthenticatedEncryptionSettings", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ValidationAlgorithm", - "Visibility": "Public", - "Kind": "Enumeration", - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Field", - "Name": "HMACSHA256", - "Parameters": [], - "GenericParameter": [], - "Literal": "0" - }, - { - "Kind": "Field", - "Name": "HMACSHA512", - "Parameters": [], - "GenericParameter": [], - "Literal": "1" - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorConfiguration", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IInternalAuthenticatedEncryptorConfiguration" - ], - "Members": [ - { - "Kind": "Method", - "Name": "get_Settings", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.AuthenticatedEncryptionSettings", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "CreateNewDescriptor", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorConfiguration", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.AuthenticatedEncryptionSettings" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.AuthenticatedEncryptionSettings" - }, - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptor", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor" - ], - "Members": [ - { - "Kind": "Method", - "Name": "CreateEncryptorInstance", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryptor", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ExportToXml", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.XmlSerializedDescriptorInfo", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.AuthenticatedEncryptionSettings" - }, - { - "Name": "masterKey", - "Type": "Microsoft.AspNetCore.DataProtection.ISecret" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.AuthenticatedEncryptionSettings" - }, - { - "Name": "masterKey", - "Type": "Microsoft.AspNetCore.DataProtection.ISecret" - }, - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.AuthenticatedEncryptorDescriptorDeserializer", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptorDeserializer" - ], - "Members": [ - { - "Kind": "Method", - "Name": "ImportFromXml", - "Parameters": [ - { - "Name": "element", - "Type": "System.Xml.Linq.XElement" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptorDeserializer", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.CngCbcAuthenticatedEncryptorConfiguration", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IInternalAuthenticatedEncryptorConfiguration" - ], - "Members": [ - { - "Kind": "Method", - "Name": "get_Settings", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngCbcAuthenticatedEncryptionSettings", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "CreateNewDescriptor", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorConfiguration", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngCbcAuthenticatedEncryptionSettings" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngCbcAuthenticatedEncryptionSettings" - }, - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.CngCbcAuthenticatedEncryptorDescriptor", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor" - ], - "Members": [ - { - "Kind": "Method", - "Name": "CreateEncryptorInstance", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryptor", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ExportToXml", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.XmlSerializedDescriptorInfo", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngCbcAuthenticatedEncryptionSettings" - }, - { - "Name": "masterKey", - "Type": "Microsoft.AspNetCore.DataProtection.ISecret" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngCbcAuthenticatedEncryptionSettings" - }, - { - "Name": "masterKey", - "Type": "Microsoft.AspNetCore.DataProtection.ISecret" - }, - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.CngCbcAuthenticatedEncryptorDescriptorDeserializer", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptorDeserializer" - ], - "Members": [ - { - "Kind": "Method", - "Name": "ImportFromXml", - "Parameters": [ - { - "Name": "element", - "Type": "System.Xml.Linq.XElement" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptorDeserializer", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.CngGcmAuthenticatedEncryptorConfiguration", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IInternalAuthenticatedEncryptorConfiguration" - ], - "Members": [ - { - "Kind": "Method", - "Name": "get_Settings", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngGcmAuthenticatedEncryptionSettings", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "CreateNewDescriptor", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorConfiguration", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngGcmAuthenticatedEncryptionSettings" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngGcmAuthenticatedEncryptionSettings" - }, - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.CngGcmAuthenticatedEncryptorDescriptor", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor" - ], - "Members": [ - { - "Kind": "Method", - "Name": "CreateEncryptorInstance", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryptor", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ExportToXml", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.XmlSerializedDescriptorInfo", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngGcmAuthenticatedEncryptionSettings" - }, - { - "Name": "masterKey", - "Type": "Microsoft.AspNetCore.DataProtection.ISecret" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngGcmAuthenticatedEncryptionSettings" - }, - { - "Name": "masterKey", - "Type": "Microsoft.AspNetCore.DataProtection.ISecret" - }, - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.CngGcmAuthenticatedEncryptorDescriptorDeserializer", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptorDeserializer" - ], - "Members": [ - { - "Kind": "Method", - "Name": "ImportFromXml", - "Parameters": [ - { - "Name": "element", - "Type": "System.Xml.Linq.XElement" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptorDeserializer", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorConfiguration", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "CreateNewDescriptor", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "CreateEncryptorInstance", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryptor", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ExportToXml", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.XmlSerializedDescriptorInfo", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptorDeserializer", - "Visibility": "Public", - "Kind": "Interface", - "Abstract": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "ImportFromXml", - "Parameters": [ - { - "Name": "element", - "Type": "System.Xml.Linq.XElement" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.ManagedAuthenticatedEncryptorConfiguration", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IInternalAuthenticatedEncryptorConfiguration" - ], - "Members": [ - { - "Kind": "Method", - "Name": "get_Settings", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ManagedAuthenticatedEncryptionSettings", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "CreateNewDescriptor", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorConfiguration", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ManagedAuthenticatedEncryptionSettings" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ManagedAuthenticatedEncryptionSettings" - }, - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.ManagedAuthenticatedEncryptorDescriptor", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor" - ], - "Members": [ - { - "Kind": "Method", - "Name": "CreateEncryptorInstance", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.IAuthenticatedEncryptor", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ExportToXml", - "Parameters": [], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.XmlSerializedDescriptorInfo", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ManagedAuthenticatedEncryptionSettings" - }, - { - "Name": "masterKey", - "Type": "Microsoft.AspNetCore.DataProtection.ISecret" - } - ], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "settings", - "Type": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ManagedAuthenticatedEncryptionSettings" - }, - { - "Name": "masterKey", - "Type": "Microsoft.AspNetCore.DataProtection.ISecret" - }, - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.ManagedAuthenticatedEncryptorDescriptorDeserializer", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [ - "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptorDeserializer" - ], - "Members": [ - { - "Kind": "Method", - "Name": "ImportFromXml", - "Parameters": [ - { - "Name": "element", - "Type": "System.Xml.Linq.XElement" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptor", - "Sealed": true, - "Virtual": true, - "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.IAuthenticatedEncryptorDescriptorDeserializer", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.XmlExtensions", - "Visibility": "Public", - "Kind": "Class", - "Abstract": true, - "Static": true, - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "MarkAsRequiresEncryption", - "Parameters": [ - { - "Name": "element", - "Type": "System.Xml.Linq.XElement" - } - ], - "ReturnType": "System.Void", - "Static": true, - "Extension": true, - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.ConfigurationModel.XmlSerializedDescriptorInfo", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_DeserializerType", - "Parameters": [], - "ReturnType": "System.Type", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "get_SerializedDescriptorElement", - "Parameters": [], - "ReturnType": "System.Xml.Linq.XElement", - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "serializedDescriptorElement", - "Type": "System.Xml.Linq.XElement" - }, - { - "Name": "deserializerType", - "Type": "System.Type" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - } - ] -} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.DataProtection/baseline.netcore.json b/src/Microsoft.AspNetCore.DataProtection/baseline.netcore.json index 122e26797f..17dd37fc63 100644 --- a/src/Microsoft.AspNetCore.DataProtection/baseline.netcore.json +++ b/src/Microsoft.AspNetCore.DataProtection/baseline.netcore.json @@ -230,6 +230,44 @@ "Visibility": "Public", "GenericParameter": [] }, + { + "Kind": "Method", + "Name": "ProtectKeysWithCertificate", + "Parameters": [ + { + "Name": "builder", + "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" + }, + { + "Name": "certificate", + "Type": "System.Security.Cryptography.X509Certificates.X509Certificate2" + } + ], + "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", + "Static": true, + "Extension": true, + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Method", + "Name": "ProtectKeysWithCertificate", + "Parameters": [ + { + "Name": "builder", + "Type": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder" + }, + { + "Name": "thumbprint", + "Type": "System.String" + } + ], + "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionBuilder", + "Static": true, + "Extension": true, + "Visibility": "Public", + "GenericParameter": [] + }, { "Kind": "Method", "Name": "ProtectKeysWithDpapi", @@ -745,6 +783,132 @@ ], "GenericParameters": [] }, + { + "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.CertificateResolver", + "Visibility": "Public", + "Kind": "Class", + "ImplementedInterfaces": [ + "Microsoft.AspNetCore.DataProtection.XmlEncryption.ICertificateResolver" + ], + "Members": [ + { + "Kind": "Method", + "Name": "ResolveCertificate", + "Parameters": [ + { + "Name": "thumbprint", + "Type": "System.String" + } + ], + "ReturnType": "System.Security.Cryptography.X509Certificates.X509Certificate2", + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.XmlEncryption.ICertificateResolver", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, + { + "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.CertificateXmlEncryptor", + "Visibility": "Public", + "Kind": "Class", + "Sealed": true, + "ImplementedInterfaces": [ + "Microsoft.AspNetCore.DataProtection.XmlEncryption.IInternalCertificateXmlEncryptor", + "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlEncryptor" + ], + "Members": [ + { + "Kind": "Method", + "Name": "Encrypt", + "Parameters": [ + { + "Name": "plaintextElement", + "Type": "System.Xml.Linq.XElement" + } + ], + "ReturnType": "Microsoft.AspNetCore.DataProtection.XmlEncryption.EncryptedXmlInfo", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlEncryptor", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "thumbprint", + "Type": "System.String" + }, + { + "Name": "certificateResolver", + "Type": "Microsoft.AspNetCore.DataProtection.XmlEncryption.ICertificateResolver" + } + ], + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "thumbprint", + "Type": "System.String" + }, + { + "Name": "certificateResolver", + "Type": "Microsoft.AspNetCore.DataProtection.XmlEncryption.ICertificateResolver" + }, + { + "Name": "services", + "Type": "System.IServiceProvider" + } + ], + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "certificate", + "Type": "System.Security.Cryptography.X509Certificates.X509Certificate2" + } + ], + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "certificate", + "Type": "System.Security.Cryptography.X509Certificates.X509Certificate2" + }, + { + "Name": "services", + "Type": "System.IServiceProvider" + } + ], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, { "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.DpapiNGProtectionDescriptorFlags", "Visibility": "Public", @@ -990,6 +1154,54 @@ ], "GenericParameters": [] }, + { + "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.EncryptedXmlDecryptor", + "Visibility": "Public", + "Kind": "Class", + "Sealed": true, + "ImplementedInterfaces": [ + "Microsoft.AspNetCore.DataProtection.XmlEncryption.IInternalEncryptedXmlDecryptor", + "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlDecryptor" + ], + "Members": [ + { + "Kind": "Method", + "Name": "Decrypt", + "Parameters": [ + { + "Name": "encryptedElement", + "Type": "System.Xml.Linq.XElement" + } + ], + "ReturnType": "System.Xml.Linq.XElement", + "Sealed": true, + "Virtual": true, + "ImplementedInterface": "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlDecryptor", + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [], + "Visibility": "Public", + "GenericParameter": [] + }, + { + "Kind": "Constructor", + "Name": ".ctor", + "Parameters": [ + { + "Name": "services", + "Type": "System.IServiceProvider" + } + ], + "Visibility": "Public", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, { "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.EncryptedXmlInfo", "Visibility": "Public", @@ -1032,6 +1244,28 @@ ], "GenericParameters": [] }, + { + "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.ICertificateResolver", + "Visibility": "Public", + "Kind": "Interface", + "Abstract": true, + "ImplementedInterfaces": [], + "Members": [ + { + "Kind": "Method", + "Name": "ResolveCertificate", + "Parameters": [ + { + "Name": "thumbprint", + "Type": "System.String" + } + ], + "ReturnType": "System.Security.Cryptography.X509Certificates.X509Certificate2", + "GenericParameter": [] + } + ], + "GenericParameters": [] + }, { "Name": "Microsoft.AspNetCore.DataProtection.XmlEncryption.IXmlDecryptor", "Visibility": "Public", diff --git a/test/Microsoft.AspNetCore.Cryptography.Internal.Test/Microsoft.AspNetCore.Cryptography.Internal.Test.csproj b/test/Microsoft.AspNetCore.Cryptography.Internal.Test/Microsoft.AspNetCore.Cryptography.Internal.Test.csproj index 846a77a978..6b455b9067 100644 --- a/test/Microsoft.AspNetCore.Cryptography.Internal.Test/Microsoft.AspNetCore.Cryptography.Internal.Test.csproj +++ b/test/Microsoft.AspNetCore.Cryptography.Internal.Test/Microsoft.AspNetCore.Cryptography.Internal.Test.csproj @@ -3,7 +3,7 @@ - netcoreapp2.0;net46 + netcoreapp2.0;net461 netcoreapp2.0 true @@ -14,6 +14,9 @@ + + + diff --git a/test/Microsoft.AspNetCore.Cryptography.KeyDerivation.Test/Microsoft.AspNetCore.Cryptography.KeyDerivation.Test.csproj b/test/Microsoft.AspNetCore.Cryptography.KeyDerivation.Test/Microsoft.AspNetCore.Cryptography.KeyDerivation.Test.csproj index 79b3bbc0de..a2b9f2d39c 100644 --- a/test/Microsoft.AspNetCore.Cryptography.KeyDerivation.Test/Microsoft.AspNetCore.Cryptography.KeyDerivation.Test.csproj +++ b/test/Microsoft.AspNetCore.Cryptography.KeyDerivation.Test/Microsoft.AspNetCore.Cryptography.KeyDerivation.Test.csproj @@ -3,7 +3,7 @@ - netcoreapp2.0;net46 + netcoreapp2.0;net461 netcoreapp2.0 true @@ -15,6 +15,9 @@ + + + diff --git a/test/Microsoft.AspNetCore.DataProtection.Abstractions.Test/Microsoft.AspNetCore.DataProtection.Abstractions.Test.csproj b/test/Microsoft.AspNetCore.DataProtection.Abstractions.Test/Microsoft.AspNetCore.DataProtection.Abstractions.Test.csproj index 998bd51703..4a5375118b 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Abstractions.Test/Microsoft.AspNetCore.DataProtection.Abstractions.Test.csproj +++ b/test/Microsoft.AspNetCore.DataProtection.Abstractions.Test/Microsoft.AspNetCore.DataProtection.Abstractions.Test.csproj @@ -3,7 +3,7 @@ - netcoreapp2.0;net46 + netcoreapp2.0;net461 netcoreapp2.0 @@ -14,6 +14,9 @@ + + + diff --git a/test/Microsoft.AspNetCore.DataProtection.AzureStorage.Test/Microsoft.AspNetCore.DataProtection.AzureStorage.Test.csproj b/test/Microsoft.AspNetCore.DataProtection.AzureStorage.Test/Microsoft.AspNetCore.DataProtection.AzureStorage.Test.csproj index 5b8c5b01a1..290cca3a57 100644 --- a/test/Microsoft.AspNetCore.DataProtection.AzureStorage.Test/Microsoft.AspNetCore.DataProtection.AzureStorage.Test.csproj +++ b/test/Microsoft.AspNetCore.DataProtection.AzureStorage.Test/Microsoft.AspNetCore.DataProtection.AzureStorage.Test.csproj @@ -3,7 +3,7 @@ - netcoreapp2.0;net46 + netcoreapp2.0;net461 netcoreapp2.0 true $(PackageTargetFallback);dnxcore50;portable-net451+win8 @@ -12,6 +12,9 @@ + + + diff --git a/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/DataProtectionProviderTests.cs b/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/DataProtectionProviderTests.cs index d23d088d87..dee13c5ca1 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/DataProtectionProviderTests.cs +++ b/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/DataProtectionProviderTests.cs @@ -4,7 +4,9 @@ using System; using System.IO; using System.Reflection; +using System.Runtime.InteropServices; using System.Security.Cryptography.X509Certificates; +using Microsoft.AspNetCore.DataProtection.Repositories; using Microsoft.AspNetCore.DataProtection.Test.Shared; using Microsoft.AspNetCore.Testing.xunit; using Xunit; @@ -13,8 +15,7 @@ namespace Microsoft.AspNetCore.DataProtection { public class DataProtectionProviderTests { - [ConditionalFact] - [ConditionalRunTestOnlyIfLocalAppDataAvailable] + [Fact] public void System_UsesProvidedDirectory() { WithUniqueTempDirectory(directory => @@ -37,13 +38,13 @@ namespace Microsoft.AspNetCore.DataProtection }); } - [ConditionalFact] - [ConditionalRunTestOnlyIfLocalAppDataAvailable] - [ConditionalRunTestOnlyOnWindows] + [Fact] public void System_NoKeysDirectoryProvided_UsesDefaultKeysDirectory() { - var keysPath = Path.Combine(Environment.ExpandEnvironmentVariables("%LOCALAPPDATA%"), "ASP.NET", "DataProtection-Keys"); - var tempPath = Path.Combine(Environment.ExpandEnvironmentVariables("%LOCALAPPDATA%"), "ASP.NET", "DataProtection-KeysTemp"); + Assert.NotNull(FileSystemXmlRepository.DefaultKeyStorageDirectory); + + var keysPath = FileSystemXmlRepository.DefaultKeyStorageDirectory.FullName; + var tempPath = FileSystemXmlRepository.DefaultKeyStorageDirectory.FullName + "Temp"; try { @@ -57,13 +58,21 @@ namespace Microsoft.AspNetCore.DataProtection var protector = DataProtectionProvider.Create("TestApplication").CreateProtector("purpose"); Assert.Equal("payload", protector.Unprotect(protector.Protect("payload"))); - // Step 3: Validate that there's now a single key in the directory and that it's protected using Windows DPAPI. + // Step 3: Validate that there's now a single key in the directory var newFileName = Assert.Single(Directory.GetFiles(keysPath)); var file = new FileInfo(newFileName); Assert.StartsWith("key-", file.Name, StringComparison.OrdinalIgnoreCase); var fileText = File.ReadAllText(file.FullName); - Assert.DoesNotContain("Warning: the key below is in an unencrypted form.", fileText, StringComparison.Ordinal); - Assert.Contains("This key is encrypted with Windows DPAPI.", fileText, StringComparison.Ordinal); + // On Windows, validate that it's protected using Windows DPAPI. + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + Assert.DoesNotContain("Warning: the key below is in an unencrypted form.", fileText, StringComparison.Ordinal); + Assert.Contains("This key is encrypted with Windows DPAPI.", fileText, StringComparison.Ordinal); + } + else + { + Assert.Contains("Warning: the key below is in an unencrypted form.", fileText, StringComparison.Ordinal); + } } finally { @@ -79,7 +88,6 @@ namespace Microsoft.AspNetCore.DataProtection } [ConditionalFact] - [ConditionalRunTestOnlyIfLocalAppDataAvailable] [ConditionalRunTestOnlyOnWindows] public void System_UsesProvidedDirectory_WithConfigurationCallback() { @@ -106,16 +114,13 @@ namespace Microsoft.AspNetCore.DataProtection }); } -#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml - [ConditionalFact] - [ConditionalRunTestOnlyIfLocalAppDataAvailable] - [ConditionalRunTestOnlyOnWindows] + [Fact] public void System_UsesProvidedDirectoryAndCertificate() { var filePath = Path.Combine(GetTestFilesPath(), "TestCert.pfx"); var store = new X509Store(StoreName.My, StoreLocation.CurrentUser); store.Open(OpenFlags.ReadWrite); - store.Add(new X509Certificate2(filePath, "password")); + store.Add(new X509Certificate2(filePath, "password", X509KeyStorageFlags.Exportable)); store.Close(); WithUniqueTempDirectory(directory => @@ -149,10 +154,6 @@ namespace Microsoft.AspNetCore.DataProtection } }); } -#elif NETCOREAPP2_0 -#else -#error Target framework needs to be updated -#endif /// /// Runs a test and cleans up the temp directory afterward. @@ -175,13 +176,6 @@ namespace Microsoft.AspNetCore.DataProtection } } - private class ConditionalRunTestOnlyIfLocalAppDataAvailable : Attribute, ITestCondition - { - public bool IsMet => Environment.ExpandEnvironmentVariables("%LOCALAPPDATA%") != null; - - public string SkipReason { get; } = "%LOCALAPPDATA% couldn't be located."; - } - private static string GetTestFilesPath() { var projectName = typeof(DataProtectionProviderTests).GetTypeInfo().Assembly.GetName().Name; diff --git a/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/Microsoft.AspNetCore.DataProtection.Extensions.Test.csproj b/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/Microsoft.AspNetCore.DataProtection.Extensions.Test.csproj index 23599649bf..3fe0d683b7 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/Microsoft.AspNetCore.DataProtection.Extensions.Test.csproj +++ b/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/Microsoft.AspNetCore.DataProtection.Extensions.Test.csproj @@ -3,7 +3,7 @@ - netcoreapp2.0;net46 + netcoreapp2.0;net461 netcoreapp2.0 @@ -14,6 +14,9 @@ + + + diff --git a/test/Microsoft.AspNetCore.DataProtection.Redis.Test/Microsoft.AspNetCore.DataProtection.Redis.Test.csproj b/test/Microsoft.AspNetCore.DataProtection.Redis.Test/Microsoft.AspNetCore.DataProtection.Redis.Test.csproj index 3f854ec2bb..8760c8feb0 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Redis.Test/Microsoft.AspNetCore.DataProtection.Redis.Test.csproj +++ b/test/Microsoft.AspNetCore.DataProtection.Redis.Test/Microsoft.AspNetCore.DataProtection.Redis.Test.csproj @@ -3,7 +3,7 @@ - netcoreapp2.0;net46 + netcoreapp2.0;net461 netcoreapp2.0 @@ -14,6 +14,9 @@ + + + diff --git a/test/Microsoft.AspNetCore.DataProtection.Test/AnonymousImpersonation.cs b/test/Microsoft.AspNetCore.DataProtection.Test/AnonymousImpersonation.cs index ec61427bb2..15fd53ee6a 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Test/AnonymousImpersonation.cs +++ b/test/Microsoft.AspNetCore.DataProtection.Test/AnonymousImpersonation.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if NET46 +#if NET461 using System; using System.Runtime.ConstrainedExecution; using System.Runtime.InteropServices; @@ -89,4 +89,4 @@ namespace Microsoft.AspNetCore.DataProtection #elif NETCOREAPP2_0 #else #error Target framework needs to be updated -#endif \ No newline at end of file +#endif diff --git a/test/Microsoft.AspNetCore.DataProtection.Test/Cng/CngAuthenticatedEncryptorBaseTests.cs b/test/Microsoft.AspNetCore.DataProtection.Test/Cng/CngAuthenticatedEncryptorBaseTests.cs index a67d410f4f..faedbf44e9 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Test/Cng/CngAuthenticatedEncryptorBaseTests.cs +++ b/test/Microsoft.AspNetCore.DataProtection.Test/Cng/CngAuthenticatedEncryptorBaseTests.cs @@ -11,8 +11,7 @@ namespace Microsoft.AspNetCore.DataProtection.Cng.Internal { public unsafe class CngAuthenticatedEncryptorBaseTests { - [ConditionalFact] - [ConditionalRunTestOnlyOnWindows] + [Fact] public void Decrypt_ForwardsArraySegment() { // Arrange @@ -37,8 +36,7 @@ namespace Microsoft.AspNetCore.DataProtection.Cng.Internal Assert.Equal(new byte[] { 0x20, 0x21, 0x22 }, retVal); } - [ConditionalFact] - [ConditionalRunTestOnlyOnWindows] + [Fact] public void Decrypt_HandlesEmptyAADPointerFixup() { // Arrange @@ -63,8 +61,7 @@ namespace Microsoft.AspNetCore.DataProtection.Cng.Internal Assert.Equal(new byte[] { 0x20, 0x21, 0x22 }, retVal); } - [ConditionalFact] - [ConditionalRunTestOnlyOnWindows] + [Fact] public void Decrypt_HandlesEmptyCiphertextPointerFixup() { // Arrange diff --git a/test/Microsoft.AspNetCore.DataProtection.Test/Managed/ManagedAuthenticatedEncryptorTests.cs b/test/Microsoft.AspNetCore.DataProtection.Test/Managed/ManagedAuthenticatedEncryptorTests.cs index 4e5f67fc65..d279f73cf6 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Test/Managed/ManagedAuthenticatedEncryptorTests.cs +++ b/test/Microsoft.AspNetCore.DataProtection.Test/Managed/ManagedAuthenticatedEncryptorTests.cs @@ -79,8 +79,7 @@ namespace Microsoft.AspNetCore.DataProtection.Managed }); } - [ConditionalFact] - [ConditionalRunTestOnlyOnWindows] + [Fact] public void Encrypt_KnownKey() { // Arrange diff --git a/test/Microsoft.AspNetCore.DataProtection.Test/Microsoft.AspNetCore.DataProtection.Test.csproj b/test/Microsoft.AspNetCore.DataProtection.Test/Microsoft.AspNetCore.DataProtection.Test.csproj index a895a4cc31..065d45985a 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Test/Microsoft.AspNetCore.DataProtection.Test.csproj +++ b/test/Microsoft.AspNetCore.DataProtection.Test/Microsoft.AspNetCore.DataProtection.Test.csproj @@ -3,7 +3,7 @@ - netcoreapp2.0;net46 + netcoreapp2.0;net461 netcoreapp2.0 true @@ -14,6 +14,9 @@ + + + @@ -22,8 +25,4 @@ - - - - diff --git a/test/Microsoft.AspNetCore.DataProtection.Test/Repositories/FileSystemXmlRepositoryTests.cs b/test/Microsoft.AspNetCore.DataProtection.Test/Repositories/FileSystemXmlRepositoryTests.cs index a6a1f7896b..95ba4d1945 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Test/Repositories/FileSystemXmlRepositoryTests.cs +++ b/test/Microsoft.AspNetCore.DataProtection.Test/Repositories/FileSystemXmlRepositoryTests.cs @@ -4,8 +4,8 @@ using System; using System.IO; using System.Linq; +using System.Runtime.InteropServices; using System.Xml.Linq; -using Microsoft.AspNetCore.Testing.xunit; using Microsoft.Extensions.Logging.Abstractions; using Xunit; @@ -13,16 +13,19 @@ namespace Microsoft.AspNetCore.DataProtection.Repositories { public class FileSystemXmlRepositoryTests { - [ConditionalFact] - [ConditionalRunTestOnlyIfLocalAppDataAvailable] + [Fact] public void DefaultKeyStorageDirectory_Property() { + var baseDir = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + ? Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "ASP.NET") + : Path.Combine(Environment.GetEnvironmentVariable("HOME"), ".aspnet"); + var expectedDir = new DirectoryInfo(Path.Combine(baseDir, "DataProtection-Keys")).FullName; + // Act var defaultDirInfo = FileSystemXmlRepository.DefaultKeyStorageDirectory; // Assert - Assert.Equal(defaultDirInfo.FullName, - new DirectoryInfo(Path.Combine(GetLocalApplicationData(), "ASP.NET", "DataProtection-Keys")).FullName); + Assert.Equal(expectedDir, defaultDirInfo.FullName); } [Fact] @@ -156,23 +159,5 @@ namespace Microsoft.AspNetCore.DataProtection.Repositories } } } - - private static string GetLocalApplicationData() - { -#if NETCOREAPP2_0 - return Environment.GetEnvironmentVariable("LOCALAPPDATA"); -#elif NET46 - return Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); -#else -#error Target framework needs to be updated -#endif - } - - private class ConditionalRunTestOnlyIfLocalAppDataAvailable : Attribute, ITestCondition - { - public bool IsMet => GetLocalApplicationData() != null; - - public string SkipReason { get; } = "%LOCALAPPDATA% couldn't be located."; - } } } diff --git a/test/Microsoft.AspNetCore.DataProtection.Test/TypeForwardingActivatorTests.cs b/test/Microsoft.AspNetCore.DataProtection.Test/TypeForwardingActivatorTests.cs index 1d8e02d80a..d985c130f3 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Test/TypeForwardingActivatorTests.cs +++ b/test/Microsoft.AspNetCore.DataProtection.Test/TypeForwardingActivatorTests.cs @@ -103,11 +103,12 @@ namespace Microsoft.AspNetCore.DataProtection [MemberData(nameof(AssemblyVersions))] public void CreateInstance_ForwardsAcrossVersionChanges(Version version) { -#if NET46 +#if NET461 // run this test in an appdomain without testhost's custom assembly resolution hooks var setupInfo = new AppDomainSetup { - ApplicationBase = AppDomain.CurrentDomain.BaseDirectory + ApplicationBase = AppDomain.CurrentDomain.BaseDirectory, + ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, }; var domain = AppDomain.CreateDomain("TestDomain", null, setupInfo); var wrappedTestClass = (TypeForwardingActivatorTests)domain.CreateInstanceAndUnwrap(GetType().Assembly.FullName, typeof(TypeForwardingActivatorTests).FullName); @@ -132,13 +133,7 @@ namespace Microsoft.AspNetCore.DataProtection Assert.NotEqual(typeInfo.AssemblyQualifiedName, newName); Assert.IsType(activator.CreateInstance(typeof(object), newName, out var forwarded)); -#if NET46 Assert.True(forwarded, "Should have forwarded this type to new version or namespace"); -#elif NETCOREAPP2_0 - Assert.False(forwarded, "Should not have forwarded this type to new version or namespace"); -#else -#error Target framework should be updated -#endif } public static TheoryData AssemblyVersions @@ -174,4 +169,4 @@ namespace Microsoft.AspNetCore.DataProtection { } } -} \ No newline at end of file +} diff --git a/test/Microsoft.AspNetCore.DataProtection.Test/XmlEncryption/CertificateXmlEncryptionTests.cs b/test/Microsoft.AspNetCore.DataProtection.Test/XmlEncryption/CertificateXmlEncryptionTests.cs index a70e908b9d..9c5cd6b9c7 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Test/XmlEncryption/CertificateXmlEncryptionTests.cs +++ b/test/Microsoft.AspNetCore.DataProtection.Test/XmlEncryption/CertificateXmlEncryptionTests.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if NET46 using System; using System.Security.Cryptography; using System.Security.Cryptography.Xml; @@ -61,8 +60,3 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption } } } -#elif NETCOREAPP2_0 -#else -#error Target framework needs to be updated -#endif - diff --git a/test/Microsoft.AspNetCore.DataProtection.Test/XmlEncryption/DpapiXmlEncryptionTests.cs b/test/Microsoft.AspNetCore.DataProtection.Test/XmlEncryption/DpapiXmlEncryptionTests.cs index 828761b430..6806048d55 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Test/XmlEncryption/DpapiXmlEncryptionTests.cs +++ b/test/Microsoft.AspNetCore.DataProtection.Test/XmlEncryption/DpapiXmlEncryptionTests.cs @@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption XmlAssert.Equal(originalXml, roundTrippedElement); } -#if NET46 +#if NET461 [ConditionalFact] [ConditionalRunTestOnlyOnWindows] public void Encrypt_CurrentUser_Decrypt_ImpersonatedAsAnonymous_Fails()