diff --git a/src/Microsoft.AspNetCore.Cryptography.Internal/CryptoUtil.cs b/src/Microsoft.AspNetCore.Cryptography.Internal/CryptoUtil.cs index bc8bc56..8a268af 100644 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/CryptoUtil.cs +++ b/src/Microsoft.AspNetCore.Cryptography.Internal/CryptoUtil.cs @@ -9,7 +9,7 @@ using System.Security.Cryptography; using Microsoft.AspNetCore.Cryptography.Cng; using Microsoft.AspNetCore.Cryptography.Internal; -#if !DOTNET5_4 +#if !NETSTANDARD1_3 using System.Runtime.ConstrainedExecution; #endif @@ -73,7 +73,7 @@ namespace Microsoft.AspNetCore.Cryptography } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] -#if !DOTNET5_4 +#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static bool TimeConstantBuffersAreEqual(byte* bufA, byte* bufB, uint count) diff --git a/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs b/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs index 39e3ec7..2c7ca7e 100644 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs +++ b/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs @@ -4,7 +4,7 @@ using System; using System.Runtime.InteropServices; -#if DOTNET5_4 +#if NETSTANDARD1_3 namespace Microsoft.Win32.SafeHandles { internal abstract class SafeHandleZeroOrMinusOneIsInvalid : SafeHandle diff --git a/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeLibraryHandle.cs b/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeLibraryHandle.cs index 28920c4..c6ed164 100644 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeLibraryHandle.cs +++ b/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SafeLibraryHandle.cs @@ -6,7 +6,7 @@ using System.Runtime.InteropServices; using System.Security; using Microsoft.Win32.SafeHandles; -#if !DOTNET5_4 +#if !NETSTANDARD1_3 using System.Runtime.ConstrainedExecution; #endif @@ -127,12 +127,12 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles return UnsafeNativeMethods.FreeLibrary(handle); } -#if !DOTNET5_4 +#if !NETSTANDARD1_3 [SuppressUnmanagedCodeSecurity] #endif private static class UnsafeNativeMethods { -#if DOTNET5_4 +#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 @@ -140,7 +140,7 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles #endif // http://msdn.microsoft.com/en-us/library/windows/desktop/ms679351(v=vs.85).aspx -#if DOTNET5_4 +#if NETSTANDARD1_3 [DllImport(CORE_LOCALIZATION_LIB, EntryPoint = "FormatMessageW", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, SetLastError = true)] #else [DllImport(KERNEL32_LIB, EntryPoint = "FormatMessageW", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, SetLastError = true)] @@ -157,7 +157,7 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles // http://msdn.microsoft.com/en-us/library/ms683152(v=vs.85).aspx [return: MarshalAs(UnmanagedType.Bool)] -#if DOTNET5_4 +#if NETSTANDARD1_3 [DllImport(CORE_LIBRARY_LOADER_LIB, CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode)] #else [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] @@ -167,7 +167,7 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles // http://msdn.microsoft.com/en-us/library/ms683200(v=vs.85).aspx [return: MarshalAs(UnmanagedType.Bool)] -#if DOTNET5_4 +#if NETSTANDARD1_3 [DllImport(CORE_LIBRARY_LOADER_LIB, EntryPoint = "GetModuleHandleExW", CallingConvention = CallingConvention.Winapi, SetLastError = true)] #else [DllImport(KERNEL32_LIB, EntryPoint = "GetModuleHandleExW", CallingConvention = CallingConvention.Winapi, SetLastError = true)] @@ -178,7 +178,7 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles [Out] out IntPtr phModule); // http://msdn.microsoft.com/en-us/library/ms683212(v=vs.85).aspx -#if DOTNET5_4 +#if NETSTANDARD1_3 [DllImport(CORE_LIBRARY_LOADER_LIB, CallingConvention = CallingConvention.Winapi, SetLastError = true)] #else [DllImport(KERNEL32_LIB, CallingConvention = CallingConvention.Winapi, SetLastError = true)] @@ -188,7 +188,7 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles [In, MarshalAs(UnmanagedType.LPStr)] string lpProcName); // http://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx -#if DOTNET5_4 +#if NETSTANDARD1_3 [DllImport(CORE_LIBRARY_LOADER_LIB, EntryPoint = "LoadLibraryExW", CallingConvention = CallingConvention.Winapi, SetLastError = true)] #else [DllImport(KERNEL32_LIB, EntryPoint = "LoadLibraryExW", CallingConvention = CallingConvention.Winapi, SetLastError = true)] diff --git a/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SecureLocalAllocHandle.cs b/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SecureLocalAllocHandle.cs index 527c26d..9c7faee 100644 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SecureLocalAllocHandle.cs +++ b/src/Microsoft.AspNetCore.Cryptography.Internal/SafeHandles/SecureLocalAllocHandle.cs @@ -4,7 +4,7 @@ using System; using System.Runtime.InteropServices; -#if !DOTNET5_4 +#if !NETSTANDARD1_3 using System.Runtime.ConstrainedExecution; #endif @@ -41,7 +41,7 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles return newHandle; } -#if !DOTNET5_4 +#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif private void AllocateImpl(IntPtr cb) diff --git a/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeBufferUtil.cs b/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeBufferUtil.cs index 3645878..247812f 100644 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeBufferUtil.cs +++ b/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeBufferUtil.cs @@ -6,7 +6,7 @@ using System.Runtime.CompilerServices; using System.Threading; using Microsoft.AspNetCore.Cryptography.SafeHandles; -#if !DOTNET5_4 +#if !NETSTANDARD1_3 using System.Runtime.ConstrainedExecution; #endif @@ -15,7 +15,7 @@ namespace Microsoft.AspNetCore.Cryptography internal unsafe static class UnsafeBufferUtil { [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if !DOTNET5_4 +#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static void BlockCopy(void* from, void* to, int byteCount) @@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Cryptography } [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if !DOTNET5_4 +#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static void BlockCopy(void* from, void* to, uint byteCount) @@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.Cryptography } } -#if !DOTNET5_4 +#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void BlockCopy(LocalAllocHandle from, void* to, uint byteCount) @@ -55,7 +55,7 @@ namespace Microsoft.AspNetCore.Cryptography } } -#if !DOTNET5_4 +#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void BlockCopy(void* from, LocalAllocHandle to, uint byteCount) @@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.Cryptography } } -#if !DOTNET5_4 +#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void BlockCopy(LocalAllocHandle from, LocalAllocHandle to, IntPtr length) @@ -116,7 +116,7 @@ namespace Microsoft.AspNetCore.Cryptography [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void BlockCopyCore(byte* from, byte* to, uint byteCount) { -#if DOTNET5_4 +#if NETSTANDARD1_3 Buffer.MemoryCopy(from, to, (ulong)byteCount, (ulong)byteCount); #else while (byteCount-- != 0) @@ -129,7 +129,7 @@ namespace Microsoft.AspNetCore.Cryptography [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void BlockCopyCore(byte* from, byte* to, ulong byteCount) { -#if DOTNET5_4 +#if NETSTANDARD1_3 Buffer.MemoryCopy(from, to, byteCount, byteCount); #else while (byteCount-- != 0) @@ -143,7 +143,7 @@ namespace Microsoft.AspNetCore.Cryptography /// Securely clears a memory buffer. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if !DOTNET5_4 +#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static void SecureZeroMemory(byte* buffer, int byteCount) @@ -155,7 +155,7 @@ namespace Microsoft.AspNetCore.Cryptography /// Securely clears a memory buffer. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if !DOTNET5_4 +#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static void SecureZeroMemory(byte* buffer, uint byteCount) @@ -176,7 +176,7 @@ namespace Microsoft.AspNetCore.Cryptography /// Securely clears a memory buffer. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if !DOTNET5_4 +#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static void SecureZeroMemory(byte* buffer, ulong byteCount) @@ -196,7 +196,7 @@ namespace Microsoft.AspNetCore.Cryptography /// /// Securely clears a memory buffer. /// -#if !DOTNET5_4 +#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static void SecureZeroMemory(byte* buffer, IntPtr length) diff --git a/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeNativeMethods.cs b/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeNativeMethods.cs index 1de8dbc..73cf4e9 100644 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeNativeMethods.cs +++ b/src/Microsoft.AspNetCore.Cryptography.Internal/UnsafeNativeMethods.cs @@ -12,13 +12,13 @@ using Microsoft.AspNetCore.Cryptography.Cng; using Microsoft.AspNetCore.Cryptography.SafeHandles; using Microsoft.Win32.SafeHandles; -#if !DOTNET5_4 +#if !NETSTANDARD1_3 using System.Runtime.ConstrainedExecution; #endif namespace Microsoft.AspNetCore.Cryptography { -#if !DOTNET5_4 +#if !NETSTANDARD1_3 [SuppressUnmanagedCodeSecurity] #endif internal unsafe static class UnsafeNativeMethods @@ -87,7 +87,7 @@ namespace Microsoft.AspNetCore.Cryptography [In] uint dwFlags); [DllImport(BCRYPT_LIB, CallingConvention = CallingConvention.Winapi)] -#if !DOTNET5_4 +#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif // http://msdn.microsoft.com/en-us/library/windows/desktop/aa375399(v=vs.85).aspx @@ -95,7 +95,7 @@ namespace Microsoft.AspNetCore.Cryptography [In] IntPtr hHash); [DllImport(BCRYPT_LIB, CallingConvention = CallingConvention.Winapi)] -#if !DOTNET5_4 +#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif // http://msdn.microsoft.com/en-us/library/windows/desktop/aa375404(v=vs.85).aspx @@ -249,7 +249,7 @@ namespace Microsoft.AspNetCore.Cryptography */ [DllImport(NCRYPT_LIB, CallingConvention = CallingConvention.Winapi)] -#if !DOTNET5_4 +#if !NETSTANDARD1_3 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif // http://msdn.microsoft.com/en-us/library/windows/desktop/hh706799(v=vs.85).aspx diff --git a/src/Microsoft.AspNetCore.Cryptography.Internal/project.json b/src/Microsoft.AspNetCore.Cryptography.Internal/project.json index 8c53951..ebd11d6 100644 --- a/src/Microsoft.AspNetCore.Cryptography.Internal/project.json +++ b/src/Microsoft.AspNetCore.Cryptography.Internal/project.json @@ -8,21 +8,26 @@ "dependencies": {}, "frameworks": { "net451": {}, - "dotnet5.4": { + "netstandard1.3": { "dependencies": { "System.Diagnostics.Debug": "4.0.11-*", "System.Runtime.Handles": "4.0.1-*", "System.Runtime.InteropServices": "4.1.0-*", "System.Security.Cryptography.Primitives": "4.0.0-*", "System.Threading": "4.0.11-*" - } + }, + "imports": [ + "dotnet5.4" + ] } }, "compilationOptions": { "allowUnsafe": true, "warningsAsErrors": true, "keyFile": "../../tools/Key.snk", - "nowarn": [ "CS1591" ], + "nowarn": [ + "CS1591" + ], "xmlDoc": true } -} +} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.Cryptography.KeyDerivation/project.json b/src/Microsoft.AspNetCore.Cryptography.KeyDerivation/project.json index 0f1ff14..1ba9922 100644 --- a/src/Microsoft.AspNetCore.Cryptography.KeyDerivation/project.json +++ b/src/Microsoft.AspNetCore.Cryptography.KeyDerivation/project.json @@ -10,19 +10,24 @@ }, "frameworks": { "net451": {}, - "dotnet5.4": { + "netstandard1.3": { "dependencies": { "System.Runtime.Extensions": "4.1.0-*", "System.Security.Cryptography.Algorithms": "4.0.0-*", "System.Text.Encoding.Extensions": "4.0.11-*" - } + }, + "imports": [ + "dotnet5.4" + ] } }, "compilationOptions": { "allowUnsafe": true, "warningsAsErrors": true, "keyFile": "../../tools/Key.snk", - "nowarn": [ "CS1591" ], + "nowarn": [ + "CS1591" + ], "xmlDoc": true } -} +} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.DataProtection.Abstractions/project.json b/src/Microsoft.AspNetCore.DataProtection.Abstractions/project.json index 3673818..eb8ade7 100644 --- a/src/Microsoft.AspNetCore.DataProtection.Abstractions/project.json +++ b/src/Microsoft.AspNetCore.DataProtection.Abstractions/project.json @@ -14,17 +14,22 @@ }, "frameworks": { "net451": {}, - "dotnet5.4": { + "netstandard1.3": { "dependencies": { "System.ComponentModel": "4.0.1-*", "System.Diagnostics.Debug": "4.0.11-*" - } + }, + "imports": [ + "dotnet5.4" + ] } }, "compilationOptions": { "warningsAsErrors": true, "keyFile": "../../tools/Key.snk", - "nowarn": [ "CS1591" ], + "nowarn": [ + "CS1591" + ], "xmlDoc": true } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.DataProtection.Extensions/project.json b/src/Microsoft.AspNetCore.DataProtection.Extensions/project.json index cbdf080..14d7784 100644 --- a/src/Microsoft.AspNetCore.DataProtection.Extensions/project.json +++ b/src/Microsoft.AspNetCore.DataProtection.Extensions/project.json @@ -15,12 +15,18 @@ }, "frameworks": { "net451": {}, - "dotnet5.4": {} + "netstandard1.3": { + "imports": [ + "dotnet5.4" + ] + } }, "compilationOptions": { "warningsAsErrors": true, "keyFile": "../../tools/Key.snk", - "nowarn": [ "CS1591" ], + "nowarn": [ + "CS1591" + ], "xmlDoc": true } } \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.DataProtection.Sources/project.json b/src/Microsoft.AspNetCore.DataProtection.Sources/project.json index e04fdd4..b205184 100644 --- a/src/Microsoft.AspNetCore.DataProtection.Sources/project.json +++ b/src/Microsoft.AspNetCore.DataProtection.Sources/project.json @@ -8,11 +8,14 @@ "dependencies": {}, "frameworks": { "net451": {}, - "dotnet5.4": { + "netstandard1.3": { "dependencies": { "System.Security.Cryptography.Primitives": "4.0.0-*", "System.Text.Encoding.Extensions": "4.0.11-*" - } + }, + "imports": [ + "dotnet5.4" + ] } }, "shared": "**\\*.cs", @@ -20,4 +23,4 @@ "warningsAsErrors": true, "keyFile": "../../tools/Key.snk" } -} +} \ No newline at end of file diff --git a/src/Microsoft.AspNetCore.DataProtection/AuthenticatedEncryption/ManagedAuthenticatedEncryptionOptions.cs b/src/Microsoft.AspNetCore.DataProtection/AuthenticatedEncryption/ManagedAuthenticatedEncryptionOptions.cs index 038680f..622e37d 100644 --- a/src/Microsoft.AspNetCore.DataProtection/AuthenticatedEncryption/ManagedAuthenticatedEncryptionOptions.cs +++ b/src/Microsoft.AspNetCore.DataProtection/AuthenticatedEncryption/ManagedAuthenticatedEncryptionOptions.cs @@ -119,7 +119,7 @@ namespace Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption if (EncryptionAlgorithmType == typeof(Aes)) { Func factory = null; -#if !DOTNET5_4 +#if !NETSTANDARD1_3 if (OSVersionUtil.IsWindows()) { // If we're on desktop CLR and running on Windows, use the FIPS-compliant implementation. diff --git a/src/Microsoft.AspNetCore.DataProtection/Cng/DpapiSecretSerializerHelper.cs b/src/Microsoft.AspNetCore.DataProtection/Cng/DpapiSecretSerializerHelper.cs index 48e4ff4..ba0bd83 100644 --- a/src/Microsoft.AspNetCore.DataProtection/Cng/DpapiSecretSerializerHelper.cs +++ b/src/Microsoft.AspNetCore.DataProtection/Cng/DpapiSecretSerializerHelper.cs @@ -78,7 +78,7 @@ namespace Microsoft.AspNetCore.DataProtection.Cng }; DATA_BLOB dataOut = default(DATA_BLOB); -#if !DOTNET5_4 +#if !NETSTANDARD1_3 RuntimeHelpers.PrepareConstrainedRegions(); #endif try @@ -168,7 +168,7 @@ namespace Microsoft.AspNetCore.DataProtection.Cng fixed (byte* pbRetVal = retVal) { bool handleAcquired = false; -#if !DOTNET5_4 +#if !NETSTANDARD1_3 RuntimeHelpers.PrepareConstrainedRegions(); #endif try @@ -218,7 +218,7 @@ namespace Microsoft.AspNetCore.DataProtection.Cng }; DATA_BLOB dataOut = default(DATA_BLOB); -#if !DOTNET5_4 +#if !NETSTANDARD1_3 RuntimeHelpers.PrepareConstrainedRegions(); #endif try @@ -291,7 +291,7 @@ namespace Microsoft.AspNetCore.DataProtection.Cng using (unencryptedPayloadHandle) { bool handleAcquired = false; -#if !DOTNET5_4 +#if !NETSTANDARD1_3 RuntimeHelpers.PrepareConstrainedRegions(); #endif try diff --git a/src/Microsoft.AspNetCore.DataProtection/DataProtectionConfiguration.cs b/src/Microsoft.AspNetCore.DataProtection/DataProtectionConfiguration.cs index c9f4e8d..a71f59b 100644 --- a/src/Microsoft.AspNetCore.DataProtection/DataProtectionConfiguration.cs +++ b/src/Microsoft.AspNetCore.DataProtection/DataProtectionConfiguration.cs @@ -11,13 +11,13 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Win32; -#if !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System.Security.Cryptography.X509Certificates; #endif namespace Microsoft.AspNetCore.DataProtection { -#if !DOTNET5_4 +#if !NETSTANDARD1_3 /// /// Provides access to configuration for the data protection system, which allows the /// developer to configure default cryptographic algorithms, key storage locations, @@ -209,7 +209,7 @@ namespace Microsoft.AspNetCore.DataProtection return this; } -#if !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !NETSTANDARD1_3 // [[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. diff --git a/src/Microsoft.AspNetCore.DataProtection/DataProtectionServiceDescriptors.cs b/src/Microsoft.AspNetCore.DataProtection/DataProtectionServiceDescriptors.cs index d21e1e0..9c4b268 100644 --- a/src/Microsoft.AspNetCore.DataProtection/DataProtectionServiceDescriptors.cs +++ b/src/Microsoft.AspNetCore.DataProtection/DataProtectionServiceDescriptors.cs @@ -13,7 +13,7 @@ using Microsoft.AspNetCore.DataProtection.XmlEncryption; using Microsoft.Extensions.Options; using Microsoft.Win32; -#if !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System.Security.Cryptography.X509Certificates; #endif @@ -69,7 +69,7 @@ namespace Microsoft.Extensions.DependencyInjection return ServiceDescriptor.Singleton(options.ToConfiguration); } -#if !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml /// /// An backed by the default implementation. /// @@ -118,7 +118,7 @@ namespace Microsoft.Extensions.DependencyInjection return ServiceDescriptor.Singleton(services => new XmlKeyManager(services)); } -#if !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml /// /// An backed by an X.509 certificate. diff --git a/src/Microsoft.AspNetCore.DataProtection/DataProtectionServices.cs b/src/Microsoft.AspNetCore.DataProtection/DataProtectionServices.cs index a76e46d..14c9bb9 100644 --- a/src/Microsoft.AspNetCore.DataProtection/DataProtectionServices.cs +++ b/src/Microsoft.AspNetCore.DataProtection/DataProtectionServices.cs @@ -110,7 +110,7 @@ namespace Microsoft.Extensions.DependencyInjection yield return DataProtectionServiceDescriptors.IDataProtectionProvider_Default(); // Provide services required for XML encryption -#if !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml yield return DataProtectionServiceDescriptors.ICertificateResolver_Default(); #endif diff --git a/src/Microsoft.AspNetCore.DataProtection/Managed/ManagedAuthenticatedEncryptor.cs b/src/Microsoft.AspNetCore.DataProtection/Managed/ManagedAuthenticatedEncryptor.cs index b381eb0..b3190b8 100644 --- a/src/Microsoft.AspNetCore.DataProtection/Managed/ManagedAuthenticatedEncryptor.cs +++ b/src/Microsoft.AspNetCore.DataProtection/Managed/ManagedAuthenticatedEncryptor.cs @@ -343,7 +343,7 @@ namespace Microsoft.AspNetCore.DataProtection.Managed using (var validationAlgorithm = CreateValidationAlgorithm(validationSubkey)) { -#if !DOTNET5_4 +#if !NETSTANDARD1_3 // As an optimization, avoid duplicating the underlying buffer if we're on desktop CLR. byte[] underlyingBuffer = outputStream.GetBuffer(); #else diff --git a/src/Microsoft.AspNetCore.DataProtection/Repositories/FileSystemXmlRepository.cs b/src/Microsoft.AspNetCore.DataProtection/Repositories/FileSystemXmlRepository.cs index 6e2eb99..9969a8b 100644 --- a/src/Microsoft.AspNetCore.DataProtection/Repositories/FileSystemXmlRepository.cs +++ b/src/Microsoft.AspNetCore.DataProtection/Repositories/FileSystemXmlRepository.cs @@ -101,7 +101,7 @@ namespace Microsoft.AspNetCore.DataProtection.Repositories private static DirectoryInfo GetDefaultKeyStorageDirectory() { -#if !DOTNET5_4 +#if !NETSTANDARD1_3 // Environment.GetFolderPath returns null if the user profile isn't loaded. string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); if (!String.IsNullOrEmpty(folderPath)) diff --git a/src/Microsoft.AspNetCore.DataProtection/StringInterpolation.cs b/src/Microsoft.AspNetCore.DataProtection/StringInterpolation.cs index 16f306b..cb6120c 100644 --- a/src/Microsoft.AspNetCore.DataProtection/StringInterpolation.cs +++ b/src/Microsoft.AspNetCore.DataProtection/StringInterpolation.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 !DOTNET5_4 +#if !NETSTANDARD1_3 // These classes allow using the C# string interpolation feature from .NET 4.5.1. // They're slimmed-down versions of the classes that exist in .NET 4.6. diff --git a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateResolver.cs b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateResolver.cs index 00f19f0..1116fd4 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 !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System; using System.Security.Cryptography.X509Certificates; diff --git a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateXmlEncryptor.cs b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateXmlEncryptor.cs index 09c64ab..03c784c 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 !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System; using System.Security.Cryptography.X509Certificates; diff --git a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/EncryptedXmlDecryptor.core50.cs b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/EncryptedXmlDecryptor.core50.cs index ac3edc0..565c30e 100644 --- a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/EncryptedXmlDecryptor.core50.cs +++ b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/EncryptedXmlDecryptor.core50.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 DOTNET5_4 +#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 diff --git a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/EncryptedXmlDecryptor.cs b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/EncryptedXmlDecryptor.cs index 6a7d639..eb8d163 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 !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System; using System.Security.Cryptography.Xml; diff --git a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/ICertificateResolver.cs b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/ICertificateResolver.cs index d87a1ec..9834687 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 !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System.Security.Cryptography.X509Certificates; diff --git a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IInternalCertificateXmlEncryptor.cs b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IInternalCertificateXmlEncryptor.cs index 5507b68..1e3cfea 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 !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System; using System.Xml; diff --git a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IInternalEncryptedXmlDecryptor.cs b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/IInternalEncryptedXmlDecryptor.cs index b54bbcd..0bdf668 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 !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !NETSTANDARD1_3 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System; using System.Security.Cryptography.Xml; diff --git a/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/XmlEncryptionExtensions.cs b/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/XmlEncryptionExtensions.cs index 6505412..2d155ef 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 !DOTNET5_4 +#if !NETSTANDARD1_3 byte[] underlyingBuffer = memoryStream.GetBuffer(); fixed (byte* __unused__ = underlyingBuffer) // try to limit this moving around in memory while we allocate { diff --git a/src/Microsoft.AspNetCore.DataProtection/project.json b/src/Microsoft.AspNetCore.DataProtection/project.json index 9372a62..cd44733 100644 --- a/src/Microsoft.AspNetCore.DataProtection/project.json +++ b/src/Microsoft.AspNetCore.DataProtection/project.json @@ -25,21 +25,26 @@ "System.Xml.Linq": "" } }, - "dotnet5.4": { + "netstandard1.3": { "dependencies": { "Microsoft.Win32.Registry": "4.0.0-*", "System.Security.Cryptography.X509Certificates": "4.0.0-*", "System.Security.Claims": "4.0.1-*", "System.Security.Principal.Windows": "4.0.0-*", "System.Xml.XDocument": "4.0.11-*" - } + }, + "imports": [ + "dotnet5.4" + ] } }, "compilationOptions": { "allowUnsafe": true, "warningsAsErrors": true, "keyFile": "../../tools/Key.snk", - "nowarn": [ "CS1591" ], + "nowarn": [ + "CS1591" + ], "xmlDoc": true } } \ No newline at end of file diff --git a/test/Microsoft.AspNetCore.Cryptography.Internal.Test/project.json b/test/Microsoft.AspNetCore.Cryptography.Internal.Test/project.json index 308877a..ffa391f 100644 --- a/test/Microsoft.AspNetCore.Cryptography.Internal.Test/project.json +++ b/test/Microsoft.AspNetCore.Cryptography.Internal.Test/project.json @@ -10,11 +10,14 @@ "xunit": "2.1.0" }, "frameworks": { - "dnxcore50": { + "netstandardapp1.5": { "dependencies": { "dotnet-test-xunit": "1.0.0-dev-*" }, - "imports": "portable-net451+win8" + "imports": [ + "dnxcore50", + "portable-net451+win8" + ] }, "net451": { "dependencies": { diff --git a/test/Microsoft.AspNetCore.Cryptography.KeyDerivation.Test/project.json b/test/Microsoft.AspNetCore.Cryptography.KeyDerivation.Test/project.json index 4263161..b6446be 100644 --- a/test/Microsoft.AspNetCore.Cryptography.KeyDerivation.Test/project.json +++ b/test/Microsoft.AspNetCore.Cryptography.KeyDerivation.Test/project.json @@ -8,11 +8,14 @@ "xunit": "2.1.0" }, "frameworks": { - "dnxcore50": { + "netstandardapp1.5": { "dependencies": { "dotnet-test-xunit": "1.0.0-dev-*" }, - "imports": "portable-net451+win8" + "imports": [ + "dnxcore50", + "portable-net451+win8" + ] }, "net451": { "dependencies": { diff --git a/test/Microsoft.AspNetCore.DataProtection.Abstractions.Test/project.json b/test/Microsoft.AspNetCore.DataProtection.Abstractions.Test/project.json index 0c2f5f6..f0676e9 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Abstractions.Test/project.json +++ b/test/Microsoft.AspNetCore.DataProtection.Abstractions.Test/project.json @@ -7,12 +7,15 @@ "xunit": "2.1.0" }, "frameworks": { - "dnxcore50": { + "netstandardapp1.5": { "dependencies": { "moq.netcore": "4.4.0-beta8", "dotnet-test-xunit": "1.0.0-dev-*" }, - "imports": "portable-net451+win8" + "imports": [ + "dnxcore50", + "portable-net451+win8" + ] }, "net451": { "dependencies": { diff --git a/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/project.json b/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/project.json index f892ec3..d5fddc8 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/project.json +++ b/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/project.json @@ -11,12 +11,15 @@ "xunit": "2.1.0" }, "frameworks": { - "dnxcore50": { + "netstandardapp1.5": { "dependencies": { "moq.netcore": "4.4.0-beta8", "dotnet-test-xunit": "1.0.0-dev-*" }, - "imports": "portable-net451+win8" + "imports": [ + "dnxcore50", + "portable-net451+win8" + ] }, "net451": { "dependencies": { diff --git a/test/Microsoft.AspNetCore.DataProtection.Test.Shared/project.json b/test/Microsoft.AspNetCore.DataProtection.Test.Shared/project.json index 69ab8c7..fbbb894 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Test.Shared/project.json +++ b/test/Microsoft.AspNetCore.DataProtection.Test.Shared/project.json @@ -1,11 +1,14 @@ { "frameworks": { - "dnxcore50": { + "netstandardapp1.5": { "dependencies": { "dotnet-test-xunit": "1.0.0-dev-*", "Microsoft.NETCore.Platforms": "1.0.1-*" }, - "imports": "portable-net451+win8" + "imports": [ + "dnxcore50", + "portable-net451+win8" + ] }, "net451": {} }, diff --git a/test/Microsoft.AspNetCore.DataProtection.Test/Repositories/FileSystemXmlRepositoryTests.cs b/test/Microsoft.AspNetCore.DataProtection.Test/Repositories/FileSystemXmlRepositoryTests.cs index 236f98c..2ed3f84 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Test/Repositories/FileSystemXmlRepositoryTests.cs +++ b/test/Microsoft.AspNetCore.DataProtection.Test/Repositories/FileSystemXmlRepositoryTests.cs @@ -158,7 +158,7 @@ namespace Microsoft.AspNetCore.DataProtection.Repositories private static string GetLocalApplicationData() { -#if DNXCORE50 +#if NETSTANDARDAPP1_5 return Environment.GetEnvironmentVariable("LOCALAPPDATA"); #else return Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); diff --git a/test/Microsoft.AspNetCore.DataProtection.Test/XmlEncryption/CertificateXmlEncryptionTests.cs b/test/Microsoft.AspNetCore.DataProtection.Test/XmlEncryption/CertificateXmlEncryptionTests.cs index 79e2b2d..4655d87 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 !DNXCORE50 +#if !NETSTANDARDAPP1_5 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 8929ae9..775c63b 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Test/XmlEncryption/DpapiXmlEncryptionTests.cs +++ b/test/Microsoft.AspNetCore.DataProtection.Test/XmlEncryption/DpapiXmlEncryptionTests.cs @@ -33,7 +33,7 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption XmlAssert.Equal(originalXml, roundTrippedElement); } -#if !DNXCORE50 +#if !NETSTANDARDAPP1_5 [ConditionalFact] [ConditionalRunTestOnlyOnWindows] public void Encrypt_CurrentUser_Decrypt_ImpersonatedAsAnonymous_Fails() diff --git a/test/Microsoft.AspNetCore.DataProtection.Test/project.json b/test/Microsoft.AspNetCore.DataProtection.Test/project.json index 5622521..9897b9b 100644 --- a/test/Microsoft.AspNetCore.DataProtection.Test/project.json +++ b/test/Microsoft.AspNetCore.DataProtection.Test/project.json @@ -11,12 +11,15 @@ "xunit": "2.1.0" }, "frameworks": { - "dnxcore50": { + "netstandardapp1.5": { "dependencies": { "moq.netcore": "4.4.0-beta8", "dotnet-test-xunit": "1.0.0-dev-*" }, - "imports": "portable-net451+win8" + "imports": [ + "dnxcore50", + "portable-net451+win8" + ] }, "net451": { "dependencies": {