From 91406009d3322f1b0c58f442883cecf52efcfcf8 Mon Sep 17 00:00:00 2001 From: Pranav K Date: Sun, 12 Mar 2017 17:28:11 -0700 Subject: [PATCH] Remove net451 as a cross-compile target --- .gitignore | 3 +- .../CustomEncryptorSample.csproj | 2 +- .../KeyManagementSample.csproj | 2 +- samples/NonDISample/NonDISample.csproj | 2 +- samples/Redis/Redis.csproj | 2 +- .../CryptoUtil.cs | 5 +++- ...ft.AspNetCore.Cryptography.Internal.csproj | 2 +- .../SafeHandleZeroOrMinusOneIsInvalid.cs | 3 ++ .../SafeHandles/SafeLibraryHandle.cs | 29 ++++++++++++++----- .../SafeHandles/SecureLocalAllocHandle.cs | 5 +++- .../UnsafeNativeMethods.cs | 22 ++++++++++---- ...pNetCore.Cryptography.KeyDerivation.csproj | 2 +- ...NetCore.DataProtection.Abstractions.csproj | 2 +- ...NetCore.DataProtection.AzureStorage.csproj | 2 +- .../DataProtectionProvider.cs | 10 +++++-- ...spNetCore.DataProtection.Extensions.csproj | 2 +- ...oft.AspNetCore.DataProtection.Redis.csproj | 2 +- ...AspNetCore.DataProtection.SystemWeb.csproj | 4 +-- .../Cng/DpapiSecretSerializerHelper.cs | 20 ++++++++++--- .../DataProtectionBuilderExtensions.cs | 8 +++-- ...taProtectionServiceCollectionExtensions.cs | 5 +++- .../IDataProtectionBuilder.cs | 6 ++-- .../Managed/ManagedAuthenticatedEncryptor.cs | 6 ++-- ...Microsoft.AspNetCore.DataProtection.csproj | 4 +-- .../Repositories/FileSystemXmlRepository.cs | 6 ++-- .../XmlEncryption/CertificateResolver.cs | 6 ++-- .../XmlEncryption/CertificateXmlEncryptor.cs | 6 ++-- .../EncryptedXmlDecryptor.core50.cs | 4 ++- .../XmlEncryption/EncryptedXmlDecryptor.cs | 6 ++-- .../XmlEncryption/ICertificateResolver.cs | 6 ++-- .../IInternalCertificateXmlEncryptor.cs | 6 ++-- .../IInternalEncryptedXmlDecryptor.cs | 6 ++-- .../XmlEncryption/XmlEncryptionExtensions.cs | 6 ++-- ...pNetCore.Cryptography.Internal.Test.csproj | 3 +- ...ore.Cryptography.KeyDerivation.Test.csproj | 2 +- ...re.DataProtection.Abstractions.Test.csproj | 2 +- ...re.DataProtection.AzureStorage.Test.csproj | 2 +- .../DataProtectionProviderTests.cs | 2 +- ...Core.DataProtection.Extensions.Test.csproj | 2 +- ...spNetCore.DataProtection.Redis.Test.csproj | 2 +- .../AnonymousImpersonation.cs | 2 +- ...soft.AspNetCore.DataProtection.Test.csproj | 4 +-- .../FileSystemXmlRepositoryTests.cs | 2 +- .../CertificateXmlEncryptionTests.cs | 2 +- .../XmlEncryption/DpapiXmlEncryptionTests.cs | 2 +- 45 files changed, 155 insertions(+), 74 deletions(-) diff --git a/.gitignore b/.gitignore index fd02261e5f..5af949b050 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,5 @@ project.lock.json .vs .build/ .testPublish/ -samples/**/temp-keys/ \ No newline at end of file +samples/**/temp-keys/ +global.json diff --git a/samples/CustomEncryptorSample/CustomEncryptorSample.csproj b/samples/CustomEncryptorSample/CustomEncryptorSample.csproj index 7422388415..96ea1517fa 100644 --- a/samples/CustomEncryptorSample/CustomEncryptorSample.csproj +++ b/samples/CustomEncryptorSample/CustomEncryptorSample.csproj @@ -3,7 +3,7 @@ - net451;netcoreapp2.0 + net46;netcoreapp2.0 diff --git a/samples/KeyManagementSample/KeyManagementSample.csproj b/samples/KeyManagementSample/KeyManagementSample.csproj index 1b23de0ddf..dd0a98bd0c 100644 --- a/samples/KeyManagementSample/KeyManagementSample.csproj +++ b/samples/KeyManagementSample/KeyManagementSample.csproj @@ -3,7 +3,7 @@ - net451;netcoreapp2.0 + net46;netcoreapp2.0 diff --git a/samples/NonDISample/NonDISample.csproj b/samples/NonDISample/NonDISample.csproj index 1b23de0ddf..dd0a98bd0c 100644 --- a/samples/NonDISample/NonDISample.csproj +++ b/samples/NonDISample/NonDISample.csproj @@ -3,7 +3,7 @@ - net451;netcoreapp2.0 + net46;netcoreapp2.0 diff --git a/samples/Redis/Redis.csproj b/samples/Redis/Redis.csproj index 73863155a2..6952eb460c 100644 --- a/samples/Redis/Redis.csproj +++ b/samples/Redis/Redis.csproj @@ -3,7 +3,7 @@ - netcoreapp2.0;net451 + netcoreapp2.0;net46 diff --git a/src/Microsoft.AspNetCore.Cryptography.Internal/CryptoUtil.cs b/src/Microsoft.AspNetCore.Cryptography.Internal/CryptoUtil.cs index 8a268af986..45f405248d 100644 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/CryptoUtil.cs +++ b/src/Microsoft.AspNetCore.Cryptography.Internal/CryptoUtil.cs @@ -73,8 +73,11 @@ namespace Microsoft.AspNetCore.Cryptography } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] -#if !NETSTANDARD1_3 +#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) { 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 75e58c0965..ee4be7ad30 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. - net451;netstandard1.3 + net46;netstandard1.3 $(NoWarn);CS1591 true true diff --git a/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs b/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs index 2c7ca7eb33..b61a4c3c44 100644 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs +++ b/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs @@ -24,4 +24,7 @@ namespace Microsoft.Win32.SafeHandles } } } +#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 c6ed16428b..c1ee52202e 100644 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeLibraryHandle.cs +++ b/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeLibraryHandle.cs @@ -127,23 +127,30 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles return UnsafeNativeMethods.FreeLibrary(handle); } -#if !NETSTANDARD1_3 +#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"; -#else +#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)] -#else +#elif NET46 [DllImport(KERNEL32_LIB, EntryPoint = "FormatMessageW", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, SetLastError = true)] +#else +#error target frameworks need to be updated. #endif public static extern int FormatMessage( [In] uint dwFlags, @@ -159,9 +166,11 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles [return: MarshalAs(UnmanagedType.Bool)] #if NETSTANDARD1_3 [DllImport(CORE_LIBRARY_LOADER_LIB, CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode)] -#else +#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 internal static extern bool FreeLibrary(IntPtr hModule); @@ -169,8 +178,10 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles [return: MarshalAs(UnmanagedType.Bool)] #if NETSTANDARD1_3 [DllImport(CORE_LIBRARY_LOADER_LIB, EntryPoint = "GetModuleHandleExW", CallingConvention = CallingConvention.Winapi, SetLastError = true)] -#else +#elif NET46 [DllImport(KERNEL32_LIB, EntryPoint = "GetModuleHandleExW", CallingConvention = CallingConvention.Winapi, SetLastError = true)] +#else +#error target frameworks need to be updated. #endif internal static extern bool GetModuleHandleEx( [In] uint dwFlags, @@ -180,8 +191,10 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles // 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)] -#else +#elif NET46 [DllImport(KERNEL32_LIB, CallingConvention = CallingConvention.Winapi, SetLastError = true)] +#else +#error target frameworks need to be updated. #endif internal static extern IntPtr GetProcAddress( [In] SafeLibraryHandle hModule, @@ -190,8 +203,10 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles // 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)] -#else +#elif NET46 [DllImport(KERNEL32_LIB, EntryPoint = "LoadLibraryExW", CallingConvention = CallingConvention.Winapi, SetLastError = true)] +#else +#error target frameworks need to be updated. #endif internal static extern SafeLibraryHandle LoadLibraryEx( [In, MarshalAs(UnmanagedType.LPWStr)] string lpFileName, diff --git a/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SecureLocalAllocHandle.cs b/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SecureLocalAllocHandle.cs index 9c7faeed90..52399e0f7b 100644 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SecureLocalAllocHandle.cs +++ b/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SecureLocalAllocHandle.cs @@ -41,8 +41,11 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles return newHandle; } -#if !NETSTANDARD1_3 +#if NET46 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] +#elif NETSTANDARD1_3 +#else +#error target frameworks need to be updated. #endif private void AllocateImpl(IntPtr cb) { diff --git a/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeNativeMethods.cs b/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeNativeMethods.cs index 73cf4e91bd..c36f78997b 100644 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeNativeMethods.cs +++ b/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeNativeMethods.cs @@ -12,14 +12,17 @@ using Microsoft.AspNetCore.Cryptography.Cng; using Microsoft.AspNetCore.Cryptography.SafeHandles; using Microsoft.Win32.SafeHandles; -#if !NETSTANDARD1_3 +#if NET46 using System.Runtime.ConstrainedExecution; #endif namespace Microsoft.AspNetCore.Cryptography { -#if !NETSTANDARD1_3 +#if NET46 [SuppressUnmanagedCodeSecurity] +#elif NETSTANDARD1_3 +#else +#error target frameworks need to be updated. #endif internal unsafe static class UnsafeNativeMethods { @@ -87,16 +90,22 @@ namespace Microsoft.AspNetCore.Cryptography [In] uint dwFlags); [DllImport(BCRYPT_LIB, CallingConvention = CallingConvention.Winapi)] -#if !NETSTANDARD1_3 +#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 !NETSTANDARD1_3 +#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( @@ -249,8 +258,11 @@ namespace Microsoft.AspNetCore.Cryptography */ [DllImport(NCRYPT_LIB, CallingConvention = CallingConvention.Winapi)] -#if !NETSTANDARD1_3 +#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( 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 a93ee65f94..4ff88fbf5e 100644 --- a/src/Microsoft.AspNetCore.Cryptography.KeyDerivation/Microsoft.AspNetCore.Cryptography.KeyDerivation.csproj +++ b/src/Microsoft.AspNetCore.Cryptography.KeyDerivation/Microsoft.AspNetCore.Cryptography.KeyDerivation.csproj @@ -4,7 +4,7 @@ ASP.NET Core utilities for key derivation. - net451;netstandard1.3 + netstandard1.3 $(NoWarn);CS1591 true true 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 4a2cef6f08..788a8fc77c 100644 --- a/src/Microsoft.AspNetCore.DataProtection.Abstractions/Microsoft.AspNetCore.DataProtection.Abstractions.csproj +++ b/src/Microsoft.AspNetCore.DataProtection.Abstractions/Microsoft.AspNetCore.DataProtection.Abstractions.csproj @@ -7,7 +7,7 @@ Commonly used types: Microsoft.AspNetCore.DataProtection.IDataProtectionProvider Microsoft.AspNetCore.DataProtection.IDataProtector - net451;netstandard1.3 + netstandard1.3 $(NoWarn);CS1591 true aspnetcore;dataprotection 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 b830b0f744..c2c890d657 100644 --- a/src/Microsoft.AspNetCore.DataProtection.AzureStorage/Microsoft.AspNetCore.DataProtection.AzureStorage.csproj +++ b/src/Microsoft.AspNetCore.DataProtection.AzureStorage/Microsoft.AspNetCore.DataProtection.AzureStorage.csproj @@ -5,7 +5,7 @@ Microsoft Azure Blob storrage support as key store. 1.1.0 - net451;netstandard1.5 + net46;netstandard1.5 $(NoWarn);CS1591 true true diff --git a/src/Microsoft.AspNetCore.DataProtection.Extensions/DataProtectionProvider.cs b/src/Microsoft.AspNetCore.DataProtection.Extensions/DataProtectionProvider.cs index 58972aa4d9..1b9e30a94e 100644 --- a/src/Microsoft.AspNetCore.DataProtection.Extensions/DataProtectionProvider.cs +++ b/src/Microsoft.AspNetCore.DataProtection.Extensions/DataProtectionProvider.cs @@ -73,7 +73,7 @@ namespace Microsoft.AspNetCore.DataProtection return CreateProvider(keyDirectory, setupAction, certificate: null); } -#if !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#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,6 +150,9 @@ 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( @@ -166,11 +169,14 @@ namespace Microsoft.AspNetCore.DataProtection builder.PersistKeysToFileSystem(keyDirectory); } -#if !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#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); 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 41950e5567..fe2f163044 100644 --- a/src/Microsoft.AspNetCore.DataProtection.Extensions/Microsoft.AspNetCore.DataProtection.Extensions.csproj +++ b/src/Microsoft.AspNetCore.DataProtection.Extensions/Microsoft.AspNetCore.DataProtection.Extensions.csproj @@ -4,7 +4,7 @@ Additional APIs for ASP.NET Core data protection. - net451;netstandard1.3 + net46;netstandard1.3 $(NoWarn);CS1591 true aspnetcore;dataprotection 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 de1593b27f..e305facf8d 100644 --- a/src/Microsoft.AspNetCore.DataProtection.Redis/Microsoft.AspNetCore.DataProtection.Redis.csproj +++ b/src/Microsoft.AspNetCore.DataProtection.Redis/Microsoft.AspNetCore.DataProtection.Redis.csproj @@ -5,7 +5,7 @@ Redis storrage support as key store. 0.1.0 - net451;netstandard1.5 + net46;netstandard1.5 $(NoWarn);CS1591 true true 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 bc2dc0d8e9..d1ae6aeda7 100644 --- a/src/Microsoft.AspNetCore.DataProtection.SystemWeb/Microsoft.AspNetCore.DataProtection.SystemWeb.csproj +++ b/src/Microsoft.AspNetCore.DataProtection.SystemWeb/Microsoft.AspNetCore.DataProtection.SystemWeb.csproj @@ -4,14 +4,14 @@ A component to allow the ASP.NET Core data protection stack to work with the ASP.NET 4.x <machineKey> element. - net451 + net46 $(NoWarn);CS1591 true aspnet;aspnetcore;dataprotection - + diff --git a/src/Microsoft.AspNetCore.DataProtection/Cng/DpapiSecretSerializerHelper.cs b/src/Microsoft.AspNetCore.DataProtection/Cng/DpapiSecretSerializerHelper.cs index d007ca4412..ea37a1b989 100644 --- a/src/Microsoft.AspNetCore.DataProtection/Cng/DpapiSecretSerializerHelper.cs +++ b/src/Microsoft.AspNetCore.DataProtection/Cng/DpapiSecretSerializerHelper.cs @@ -78,8 +78,11 @@ namespace Microsoft.AspNetCore.DataProtection.Cng }; var dataOut = default(DATA_BLOB); -#if !NETSTANDARD1_3 +#if NET46 RuntimeHelpers.PrepareConstrainedRegions(); +#elif NETSTANDARD1_3 +#else +#error target frameworks need to be updated. #endif try { @@ -168,8 +171,11 @@ namespace Microsoft.AspNetCore.DataProtection.Cng fixed (byte* pbRetVal = retVal) { var handleAcquired = false; -#if !NETSTANDARD1_3 +#if NET46 RuntimeHelpers.PrepareConstrainedRegions(); +#elif NETSTANDARD1_3 +#else +#error target frameworks need to be updated. #endif try { @@ -218,8 +224,11 @@ namespace Microsoft.AspNetCore.DataProtection.Cng }; var dataOut = default(DATA_BLOB); -#if !NETSTANDARD1_3 +#if NET46 RuntimeHelpers.PrepareConstrainedRegions(); +#elif NETSTANDARD1_3 +#else +#error target frameworks need to be updated. #endif try { @@ -291,8 +300,11 @@ namespace Microsoft.AspNetCore.DataProtection.Cng using (unencryptedPayloadHandle) { var handleAcquired = false; -#if !NETSTANDARD1_3 +#if NET46 RuntimeHelpers.PrepareConstrainedRegions(); +#elif NETSTANDARD1_3 +#else +#error target frameworks need to be updated. #endif try { diff --git a/src/Microsoft.AspNetCore.DataProtection/DataProtectionBuilderExtensions.cs b/src/Microsoft.AspNetCore.DataProtection/DataProtectionBuilderExtensions.cs index e7ca436f6f..6a3a9d459c 100644 --- a/src/Microsoft.AspNetCore.DataProtection/DataProtectionBuilderExtensions.cs +++ b/src/Microsoft.AspNetCore.DataProtection/DataProtectionBuilderExtensions.cs @@ -16,7 +16,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Microsoft.Win32; -#if !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System.Security.Cryptography.X509Certificates; #endif @@ -249,7 +249,7 @@ namespace Microsoft.AspNetCore.DataProtection return builder; } -#if !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#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,7 +321,9 @@ namespace Microsoft.AspNetCore.DataProtection return builder; } - +#elif NETSTANDARD1_3 +#else +#error target frameworks need to be updated. #endif /// diff --git a/src/Microsoft.AspNetCore.DataProtection/DataProtectionServiceCollectionExtensions.cs b/src/Microsoft.AspNetCore.DataProtection/DataProtectionServiceCollectionExtensions.cs index 3fcaee8f69..4cde160961 100644 --- a/src/Microsoft.AspNetCore.DataProtection/DataProtectionServiceCollectionExtensions.cs +++ b/src/Microsoft.AspNetCore.DataProtection/DataProtectionServiceCollectionExtensions.cs @@ -98,8 +98,11 @@ namespace Microsoft.Extensions.DependencyInjection return dataProtectionProvider; }); -#if !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#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 54539f7b8e..619bdfcad4 100644 --- a/src/Microsoft.AspNetCore.DataProtection/IDataProtectionBuilder.cs +++ b/src/Microsoft.AspNetCore.DataProtection/IDataProtectionBuilder.cs @@ -7,7 +7,7 @@ using Microsoft.Extensions.DependencyInjection; namespace Microsoft.AspNetCore.DataProtection { -#if !NETSTANDARD1_3 +#if NET46 /// /// Provides access to configuration for the data protection system, which allows the /// developer to configure default cryptographic algorithms, key storage locations, @@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.DataProtection /// contain existing keys that use older algorithms or protection mechanisms. /// /// -#else +#elif NETSTANDARD1_3 /// /// Provides access to configuration for the data protection system, which allows the /// developer to configure default cryptographic algorithms, key storage locations, @@ -58,6 +58,8 @@ namespace Microsoft.AspNetCore.DataProtection /// 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 917d01f190..89cc875d10 100644 --- a/src/Microsoft.AspNetCore.DataProtection/Managed/ManagedAuthenticatedEncryptor.cs +++ b/src/Microsoft.AspNetCore.DataProtection/Managed/ManagedAuthenticatedEncryptor.cs @@ -343,11 +343,13 @@ namespace Microsoft.AspNetCore.DataProtection.Managed using (var validationAlgorithm = CreateValidationAlgorithm(validationSubkey)) { -#if !NETSTANDARD1_3 +#if NET46 // As an optimization, avoid duplicating the underlying buffer if we're on desktop CLR. var underlyingBuffer = outputStream.GetBuffer(); -#else +#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)); diff --git a/src/Microsoft.AspNetCore.DataProtection/Microsoft.AspNetCore.DataProtection.csproj b/src/Microsoft.AspNetCore.DataProtection/Microsoft.AspNetCore.DataProtection.csproj index 62c08637af..ccf9d95f42 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. - net451;netstandard1.3 + net46;netstandard1.3 $(NoWarn);CS1591 true true @@ -25,7 +25,7 @@ - + diff --git a/src/Microsoft.AspNetCore.DataProtection/Repositories/FileSystemXmlRepository.cs b/src/Microsoft.AspNetCore.DataProtection/Repositories/FileSystemXmlRepository.cs index 696e54bcae..b88f575a03 100644 --- a/src/Microsoft.AspNetCore.DataProtection/Repositories/FileSystemXmlRepository.cs +++ b/src/Microsoft.AspNetCore.DataProtection/Repositories/FileSystemXmlRepository.cs @@ -82,7 +82,7 @@ namespace Microsoft.AspNetCore.DataProtection.Repositories private static DirectoryInfo GetDefaultKeyStorageDirectory() { -#if !NETSTANDARD1_3 +#if NET46 // Environment.GetFolderPath returns null if the user profile isn't loaded. var folderPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); if (!String.IsNullOrEmpty(folderPath)) @@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.DataProtection.Repositories { return null; } -#else +#elif NETSTANDARD1_3 // On core CLR, we need to fall back to environment variables. DirectoryInfo retVal; @@ -131,6 +131,8 @@ namespace Microsoft.AspNetCore.DataProtection.Repositories { return null; } +#else +#error target frameworks need to be updated. #endif } diff --git a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateResolver.cs b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateResolver.cs index 1116fd4c10..3bf578e14a 100644 --- a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateResolver.cs +++ b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateResolver.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 !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System; using System.Security.Cryptography.X509Certificates; @@ -51,5 +51,7 @@ 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 3bf68dcc66..0cbcf30bae 100644 --- a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateXmlEncryptor.cs +++ b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateXmlEncryptor.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 !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System; using System.Security.Cryptography.X509Certificates; @@ -147,5 +147,7 @@ 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 index 565c30e297..36bba2fb81 100644 --- a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/EncryptedXmlDecryptor.core50.cs +++ b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/EncryptedXmlDecryptor.core50.cs @@ -38,5 +38,7 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption } } } - +#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 eb8d163d45..bfb70d3283 100644 --- a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/EncryptedXmlDecryptor.cs +++ b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/EncryptedXmlDecryptor.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 !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System; using System.Security.Cryptography.Xml; @@ -73,5 +73,7 @@ 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 9834687d8d..78b629fd2f 100644 --- a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/ICertificateResolver.cs +++ b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/ICertificateResolver.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 !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System.Security.Cryptography.X509Certificates; @@ -20,5 +20,7 @@ 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 1e3cfeaee0..33761a29ed 100644 --- a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IInternalCertificateXmlEncryptor.cs +++ b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IInternalCertificateXmlEncryptor.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 !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System; using System.Xml; @@ -17,5 +17,7 @@ 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 0bdf6680d6..74987d8f60 100644 --- a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IInternalEncryptedXmlDecryptor.cs +++ b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IInternalEncryptedXmlDecryptor.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 !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System; using System.Security.Cryptography.Xml; @@ -16,5 +16,7 @@ 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 073b82386d..59dcfc96e5 100644 --- a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/XmlEncryptionExtensions.cs +++ b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/XmlEncryptionExtensions.cs @@ -133,7 +133,7 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption var memoryStream = new MemoryStream(DEFAULT_BUFFER_SIZE); element.Save(memoryStream); -#if !NETSTANDARD1_3 +#if NET46 var underlyingBuffer = memoryStream.GetBuffer(); fixed (byte* __unused__ = underlyingBuffer) // try to limit this moving around in memory while we allocate { @@ -146,7 +146,7 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption Array.Clear(underlyingBuffer, 0, underlyingBuffer.Length); } } -#else +#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 @@ -160,6 +160,8 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption Array.Clear(underlyingBuffer.Array, underlyingBuffer.Offset, underlyingBuffer.Count); } } +#else +#error target frameworks need to be updated. #endif } 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 71a60ea4d8..6e44f5d7c3 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,10 +3,9 @@ - netcoreapp2.0;net452 + netcoreapp2.0;net46 netcoreapp2.0 true - $(PackageTargetFallback);dnxcore50;portable-net451+win8 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 56b23f29fd..4fec4fa063 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;net452 + netcoreapp2.0;net46 netcoreapp2.0 true 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 076480457b..8a478b5dd2 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;net452 + netcoreapp2.0;net46 netcoreapp2.0 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 fb2b75b60a..c0432a5da6 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;net452 + netcoreapp2.0;net46 netcoreapp2.0 true $(PackageTargetFallback);dnxcore50;portable-net451+win8 diff --git a/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/DataProtectionProviderTests.cs b/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/DataProtectionProviderTests.cs index 694b612ce1..d23d088d87 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/DataProtectionProviderTests.cs +++ b/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/DataProtectionProviderTests.cs @@ -106,7 +106,7 @@ namespace Microsoft.AspNetCore.DataProtection }); } -#if NET452 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if NET46 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml [ConditionalFact] [ConditionalRunTestOnlyIfLocalAppDataAvailable] [ConditionalRunTestOnlyOnWindows] 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 4dc5e85324..70bbf78e0c 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;net452 + netcoreapp2.0;net46 netcoreapp2.0 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 f873d70e1d..8f86aafb2a 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;net452 + netcoreapp2.0;net46 netcoreapp2.0 diff --git a/test/Microsoft.AspNetCore.DataProtection.Test/AnonymousImpersonation.cs b/test/Microsoft.AspNetCore.DataProtection.Test/AnonymousImpersonation.cs index 89f115beba..ec61427bb2 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 NET452 +#if NET46 using System; using System.Runtime.ConstrainedExecution; using System.Runtime.InteropServices; 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 e5f8052014..724912b1f5 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;net452 + netcoreapp2.0;net46 netcoreapp2.0 true @@ -22,7 +22,7 @@ - + diff --git a/test/Microsoft.AspNetCore.DataProtection.Test/Repositories/FileSystemXmlRepositoryTests.cs b/test/Microsoft.AspNetCore.DataProtection.Test/Repositories/FileSystemXmlRepositoryTests.cs index bb371dd889..a6a1f7896b 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Test/Repositories/FileSystemXmlRepositoryTests.cs +++ b/test/Microsoft.AspNetCore.DataProtection.Test/Repositories/FileSystemXmlRepositoryTests.cs @@ -161,7 +161,7 @@ namespace Microsoft.AspNetCore.DataProtection.Repositories { #if NETCOREAPP2_0 return Environment.GetEnvironmentVariable("LOCALAPPDATA"); -#elif NET452 +#elif NET46 return Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); #else #error Target framework needs to be updated diff --git a/test/Microsoft.AspNetCore.DataProtection.Test/XmlEncryption/CertificateXmlEncryptionTests.cs b/test/Microsoft.AspNetCore.DataProtection.Test/XmlEncryption/CertificateXmlEncryptionTests.cs index 0dd9e072c2..a70e908b9d 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Test/XmlEncryption/CertificateXmlEncryptionTests.cs +++ b/test/Microsoft.AspNetCore.DataProtection.Test/XmlEncryption/CertificateXmlEncryptionTests.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 NET452 +#if NET46 using System; using System.Security.Cryptography; using System.Security.Cryptography.Xml; diff --git a/test/Microsoft.AspNetCore.DataProtection.Test/XmlEncryption/DpapiXmlEncryptionTests.cs b/test/Microsoft.AspNetCore.DataProtection.Test/XmlEncryption/DpapiXmlEncryptionTests.cs index bcb41921d5..828761b430 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 NET452 +#if NET46 [ConditionalFact] [ConditionalRunTestOnlyOnWindows] public void Encrypt_CurrentUser_Decrypt_ImpersonatedAsAnonymous_Fails()