diff --git a/src/Microsoft.AspNet.Cryptography.Internal/CryptoUtil.cs b/src/Microsoft.AspNet.Cryptography.Internal/CryptoUtil.cs index b0a7c95703..fc2bdb9404 100644 --- a/src/Microsoft.AspNet.Cryptography.Internal/CryptoUtil.cs +++ b/src/Microsoft.AspNet.Cryptography.Internal/CryptoUtil.cs @@ -9,7 +9,7 @@ using System.Security.Cryptography; using Microsoft.AspNet.Cryptography.Cng; using Microsoft.AspNet.Cryptography.Internal; -#if !DNXCORE50 +#if !DOTNET5_4 using System.Runtime.ConstrainedExecution; #endif @@ -73,7 +73,7 @@ namespace Microsoft.AspNet.Cryptography } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] -#if !DNXCORE50 +#if !DOTNET5_4 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static bool TimeConstantBuffersAreEqual(byte* bufA, byte* bufB, uint count) diff --git a/src/Microsoft.AspNet.Cryptography.Internal/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs b/src/Microsoft.AspNet.Cryptography.Internal/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs index f00b99c2a9..39e3ec7f25 100644 --- a/src/Microsoft.AspNet.Cryptography.Internal/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs +++ b/src/Microsoft.AspNet.Cryptography.Internal/SafeHandles/SafeHandleZeroOrMinusOneIsInvalid.cs @@ -4,7 +4,7 @@ using System; using System.Runtime.InteropServices; -#if DNXCORE50 +#if DOTNET5_4 namespace Microsoft.Win32.SafeHandles { internal abstract class SafeHandleZeroOrMinusOneIsInvalid : SafeHandle diff --git a/src/Microsoft.AspNet.Cryptography.Internal/SafeHandles/SafeLibraryHandle.cs b/src/Microsoft.AspNet.Cryptography.Internal/SafeHandles/SafeLibraryHandle.cs index 86c080ca85..4636644297 100644 --- a/src/Microsoft.AspNet.Cryptography.Internal/SafeHandles/SafeLibraryHandle.cs +++ b/src/Microsoft.AspNet.Cryptography.Internal/SafeHandles/SafeLibraryHandle.cs @@ -6,7 +6,7 @@ using System.Runtime.InteropServices; using System.Security; using Microsoft.Win32.SafeHandles; -#if !DNXCORE50 +#if !DOTNET5_4 using System.Runtime.ConstrainedExecution; #endif @@ -127,12 +127,12 @@ namespace Microsoft.AspNet.Cryptography.SafeHandles return UnsafeNativeMethods.FreeLibrary(handle); } -#if !DNXCORE50 +#if !DOTNET5_4 [SuppressUnmanagedCodeSecurity] #endif private static class UnsafeNativeMethods { -#if DNXCORE50 +#if DOTNET5_4 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.AspNet.Cryptography.SafeHandles #endif // http://msdn.microsoft.com/en-us/library/windows/desktop/ms679351(v=vs.85).aspx -#if DNXCORE50 +#if DOTNET5_4 [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.AspNet.Cryptography.SafeHandles // http://msdn.microsoft.com/en-us/library/ms683152(v=vs.85).aspx [return: MarshalAs(UnmanagedType.Bool)] -#if DNXCORE50 +#if DOTNET5_4 [DllImport(CORE_LIBRARY_LOADER_LIB, CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode)] #else [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] @@ -167,7 +167,7 @@ namespace Microsoft.AspNet.Cryptography.SafeHandles // http://msdn.microsoft.com/en-us/library/ms683200(v=vs.85).aspx [return: MarshalAs(UnmanagedType.Bool)] -#if DNXCORE50 +#if DOTNET5_4 [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.AspNet.Cryptography.SafeHandles [Out] out IntPtr phModule); // http://msdn.microsoft.com/en-us/library/ms683212(v=vs.85).aspx -#if DNXCORE50 +#if DOTNET5_4 [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.AspNet.Cryptography.SafeHandles [In, MarshalAs(UnmanagedType.LPStr)] string lpProcName); // http://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx -#if DNXCORE50 +#if DOTNET5_4 [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.AspNet.Cryptography.Internal/SafeHandles/SecureLocalAllocHandle.cs b/src/Microsoft.AspNet.Cryptography.Internal/SafeHandles/SecureLocalAllocHandle.cs index ea397a0f77..36dc73ea10 100644 --- a/src/Microsoft.AspNet.Cryptography.Internal/SafeHandles/SecureLocalAllocHandle.cs +++ b/src/Microsoft.AspNet.Cryptography.Internal/SafeHandles/SecureLocalAllocHandle.cs @@ -4,7 +4,7 @@ using System; using System.Runtime.InteropServices; -#if !DNXCORE50 +#if !DOTNET5_4 using System.Runtime.ConstrainedExecution; #endif @@ -41,7 +41,7 @@ namespace Microsoft.AspNet.Cryptography.SafeHandles return newHandle; } -#if !DNXCORE50 +#if !DOTNET5_4 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif private void AllocateImpl(IntPtr cb) diff --git a/src/Microsoft.AspNet.Cryptography.Internal/UnsafeBufferUtil.cs b/src/Microsoft.AspNet.Cryptography.Internal/UnsafeBufferUtil.cs index e302c5d4fd..5f2daef596 100644 --- a/src/Microsoft.AspNet.Cryptography.Internal/UnsafeBufferUtil.cs +++ b/src/Microsoft.AspNet.Cryptography.Internal/UnsafeBufferUtil.cs @@ -6,7 +6,7 @@ using System.Runtime.CompilerServices; using System.Threading; using Microsoft.AspNet.Cryptography.SafeHandles; -#if !DNXCORE50 +#if !DOTNET5_4 using System.Runtime.ConstrainedExecution; #endif @@ -15,7 +15,7 @@ namespace Microsoft.AspNet.Cryptography internal unsafe static class UnsafeBufferUtil { [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if !DNXCORE50 +#if !DOTNET5_4 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static void BlockCopy(void* from, void* to, int byteCount) @@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Cryptography } [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if !DNXCORE50 +#if !DOTNET5_4 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static void BlockCopy(void* from, void* to, uint byteCount) @@ -35,7 +35,7 @@ namespace Microsoft.AspNet.Cryptography } } -#if !DNXCORE50 +#if !DOTNET5_4 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void BlockCopy(LocalAllocHandle from, void* to, uint byteCount) @@ -55,7 +55,7 @@ namespace Microsoft.AspNet.Cryptography } } -#if !DNXCORE50 +#if !DOTNET5_4 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void BlockCopy(void* from, LocalAllocHandle to, uint byteCount) @@ -75,7 +75,7 @@ namespace Microsoft.AspNet.Cryptography } } -#if !DNXCORE50 +#if !DOTNET5_4 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] #endif public static void BlockCopy(LocalAllocHandle from, LocalAllocHandle to, IntPtr length) @@ -116,7 +116,7 @@ namespace Microsoft.AspNet.Cryptography [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void BlockCopyCore(byte* from, byte* to, uint byteCount) { -#if DNXCORE50 +#if DOTNET5_4 Buffer.MemoryCopy(from, to, (ulong)byteCount, (ulong)byteCount); #else while (byteCount-- != 0) @@ -129,7 +129,7 @@ namespace Microsoft.AspNet.Cryptography [MethodImpl(MethodImplOptions.AggressiveInlining)] private static void BlockCopyCore(byte* from, byte* to, ulong byteCount) { -#if DNXCORE50 +#if DOTNET5_4 Buffer.MemoryCopy(from, to, byteCount, byteCount); #else while (byteCount-- != 0) @@ -143,7 +143,7 @@ namespace Microsoft.AspNet.Cryptography /// Securely clears a memory buffer. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if !DNXCORE50 +#if !DOTNET5_4 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static void SecureZeroMemory(byte* buffer, int byteCount) @@ -155,7 +155,7 @@ namespace Microsoft.AspNet.Cryptography /// Securely clears a memory buffer. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if !DNXCORE50 +#if !DOTNET5_4 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static void SecureZeroMemory(byte* buffer, uint byteCount) @@ -176,7 +176,7 @@ namespace Microsoft.AspNet.Cryptography /// Securely clears a memory buffer. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] -#if !DNXCORE50 +#if !DOTNET5_4 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static void SecureZeroMemory(byte* buffer, ulong byteCount) @@ -196,7 +196,7 @@ namespace Microsoft.AspNet.Cryptography /// /// Securely clears a memory buffer. /// -#if !DNXCORE50 +#if !DOTNET5_4 [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] #endif public static void SecureZeroMemory(byte* buffer, IntPtr length) diff --git a/src/Microsoft.AspNet.Cryptography.Internal/UnsafeNativeMethods.cs b/src/Microsoft.AspNet.Cryptography.Internal/UnsafeNativeMethods.cs index 7d06df9ff4..514b1fde51 100644 --- a/src/Microsoft.AspNet.Cryptography.Internal/UnsafeNativeMethods.cs +++ b/src/Microsoft.AspNet.Cryptography.Internal/UnsafeNativeMethods.cs @@ -12,13 +12,13 @@ using Microsoft.AspNet.Cryptography.Cng; using Microsoft.AspNet.Cryptography.SafeHandles; using Microsoft.Win32.SafeHandles; -#if !DNXCORE50 +#if !DOTNET5_4 using System.Runtime.ConstrainedExecution; #endif namespace Microsoft.AspNet.Cryptography { -#if !DNXCORE50 +#if !DOTNET5_4 [SuppressUnmanagedCodeSecurity] #endif internal unsafe static class UnsafeNativeMethods @@ -87,7 +87,7 @@ namespace Microsoft.AspNet.Cryptography [In] uint dwFlags); [DllImport(BCRYPT_LIB, CallingConvention = CallingConvention.Winapi)] -#if !DNXCORE50 +#if !DOTNET5_4 [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.AspNet.Cryptography [In] IntPtr hHash); [DllImport(BCRYPT_LIB, CallingConvention = CallingConvention.Winapi)] -#if !DNXCORE50 +#if !DOTNET5_4 [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.AspNet.Cryptography */ [DllImport(NCRYPT_LIB, CallingConvention = CallingConvention.Winapi)] -#if !DNXCORE50 +#if !DOTNET5_4 [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.AspNet.Cryptography.Internal/project.json b/src/Microsoft.AspNet.Cryptography.Internal/project.json index 071b3888dc..e57e13d42b 100644 --- a/src/Microsoft.AspNet.Cryptography.Internal/project.json +++ b/src/Microsoft.AspNet.Cryptography.Internal/project.json @@ -1,27 +1,25 @@ { - "version": "1.0.0-*", - "description": "Infrastructure for ASP.NET 5 cryptographic packages. Developers should not reference this package.", - "repository": { - "type": "git", - "url": "git://github.com/aspnet/dataprotection" - }, - "dependencies": { - }, - "frameworks": { - "net451": { }, - "dnx451": { }, - "dnxcore50": { - "dependencies": { - "System.Diagnostics.Debug": "4.0.11-beta-*", - "System.Runtime.Handles": "4.0.1-beta-*", - "System.Runtime.InteropServices": "4.0.21-beta-*", - "System.Security.Cryptography.Primitives": "4.0.0-beta-*", - "System.Threading": "4.0.11-beta-*" - } - } - }, - "compilationOptions": { - "allowUnsafe": true, - "warningsAsErrors": true + "version": "1.0.0-*", + "description": "Infrastructure for ASP.NET 5 cryptographic packages. Developers should not reference this package.", + "repository": { + "type": "git", + "url": "git://github.com/aspnet/dataprotection" + }, + "dependencies": {}, + "frameworks": { + "net451": {}, + "dotnet5.4": { + "dependencies": { + "System.Diagnostics.Debug": "4.0.11-beta-*", + "System.Runtime.Handles": "4.0.1-beta-*", + "System.Runtime.InteropServices": "4.0.21-beta-*", + "System.Security.Cryptography.Primitives": "4.0.0-beta-*", + "System.Threading": "4.0.11-beta-*" + } } -} + }, + "compilationOptions": { + "allowUnsafe": true, + "warningsAsErrors": true + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.Cryptography.KeyDerivation/project.json b/src/Microsoft.AspNet.Cryptography.KeyDerivation/project.json index 581d8c46d9..4b0e59d4b2 100644 --- a/src/Microsoft.AspNet.Cryptography.KeyDerivation/project.json +++ b/src/Microsoft.AspNet.Cryptography.KeyDerivation/project.json @@ -1,26 +1,25 @@ { - "version": "1.0.0-*", - "description": "ASP.NET 5 utilities for key derivation.", - "repository": { - "type": "git", - "url": "git://github.com/aspnet/dataprotection" - }, - "dependencies": { - "Microsoft.AspNet.Cryptography.Internal": "1.0.0-*" - }, - "frameworks": { - "net451": { }, - "dnx451": { }, - "dnxcore50": { - "dependencies": { - "System.Runtime.Extensions": "4.0.11-beta-*", - "System.Security.Cryptography.Algorithms": "4.0.0-beta-*", - "System.Text.Encoding.Extensions": "4.0.11-beta-*" - } - } - }, - "compilationOptions": { - "allowUnsafe": true, - "warningsAsErrors": true + "version": "1.0.0-*", + "description": "ASP.NET 5 utilities for key derivation.", + "repository": { + "type": "git", + "url": "git://github.com/aspnet/dataprotection" + }, + "dependencies": { + "Microsoft.AspNet.Cryptography.Internal": "1.0.0-*" + }, + "frameworks": { + "net451": {}, + "dotnet5.4": { + "dependencies": { + "System.Runtime.Extensions": "4.0.11-beta-*", + "System.Security.Cryptography.Algorithms": "4.0.0-beta-*", + "System.Text.Encoding.Extensions": "4.0.11-beta-*" + } } -} + }, + "compilationOptions": { + "allowUnsafe": true, + "warningsAsErrors": true + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.DataProtection.Abstractions/DataProtectionExtensions.cs b/src/Microsoft.AspNet.DataProtection.Abstractions/DataProtectionExtensions.cs index ee2c0fa106..9b4703829b 100644 --- a/src/Microsoft.AspNet.DataProtection.Abstractions/DataProtectionExtensions.cs +++ b/src/Microsoft.AspNet.DataProtection.Abstractions/DataProtectionExtensions.cs @@ -7,10 +7,7 @@ using System.ComponentModel; using System.Diagnostics; using Microsoft.AspNet.DataProtection.Infrastructure; using Microsoft.AspNet.DataProtection.Abstractions; - -#if DNX451 || DNXCORE50 // [[ISSUE1400]] Replace with DNX_ANY when it becomes available using Microsoft.Dnx.Runtime; -#endif namespace Microsoft.AspNet.DataProtection { @@ -124,15 +121,10 @@ namespace Microsoft.AspNet.DataProtection public static string GetApplicationUniqueIdentifier(this IServiceProvider services) { string discriminator = (services?.GetService(typeof(IApplicationDiscriminator)) as IApplicationDiscriminator)?.Discriminator; -#if DNX451 || DNXCORE50 // [[ISSUE1400]] Replace with DNX_ANY when it becomes available if (discriminator == null) { discriminator = (services?.GetService(typeof(IApplicationEnvironment)) as IApplicationEnvironment)?.ApplicationBasePath; } -#elif NET451 // do nothing -#else -#error A new target framework was added to project.json, but it's not accounted for in this #ifdef. Please change the #ifdef accordingly. -#endif // Remove whitespace and homogenize empty -> null discriminator = discriminator?.Trim(); diff --git a/src/Microsoft.AspNet.DataProtection.Abstractions/project.json b/src/Microsoft.AspNet.DataProtection.Abstractions/project.json index be542d12ff..e5f544bcdb 100644 --- a/src/Microsoft.AspNet.DataProtection.Abstractions/project.json +++ b/src/Microsoft.AspNet.DataProtection.Abstractions/project.json @@ -1,33 +1,31 @@ { - "version": "1.0.0-*", - "description": "Contains the core IDataProtector and IDataProtectionProvider abstractions for ASP.NET 5 Data Protection.", - "repository": { - "type": "git", - "url": "git://github.com/aspnet/dataprotection" + "version": "1.0.0-*", + "description": "Contains the core IDataProtector and IDataProtectionProvider abstractions for ASP.NET 5 Data Protection.", + "repository": { + "type": "git", + "url": "git://github.com/aspnet/dataprotection" + }, + "dependencies": { + "Microsoft.AspNet.DataProtection.Sources": { + "type": "build", + "version": "" }, - "dependencies": { - "Microsoft.AspNet.DataProtection.Sources": { "type": "build", "version": "" } - }, - "frameworks": { - "net451": { }, - "dnx451": { - "dependencies": { - "Microsoft.Dnx.Runtime.Abstractions": "1.0.0-*" - } - }, - "dnxcore50": { - "dependencies": { - "Microsoft.Dnx.Runtime.Abstractions": "1.0.0-*", - "System.ComponentModel": "4.0.1-beta-*", - "System.Diagnostics.Debug": "4.0.11-beta-*", - "System.Reflection": "4.0.11-beta-*", - "System.Runtime.Extensions": "4.0.11-beta-*", - "System.Security.Cryptography.Primitives": "4.0.0-beta-*", - "System.Text.Encoding.Extensions": "4.0.11-beta-*" - } - } - }, - "compilationOptions": { - "warningsAsErrors": true + "Microsoft.Dnx.Runtime.Abstractions": "1.0.0-*" + }, + "frameworks": { + "net451": {}, + "dotnet5.4": { + "dependencies": { + "System.ComponentModel": "4.0.1-beta-*", + "System.Diagnostics.Debug": "4.0.11-beta-*", + "System.Reflection": "4.0.11-beta-*", + "System.Runtime.Extensions": "4.0.11-beta-*", + "System.Security.Cryptography.Primitives": "4.0.0-beta-*", + "System.Text.Encoding.Extensions": "4.0.11-beta-*" + } } -} + }, + "compilationOptions": { + "warningsAsErrors": true + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.DataProtection.Extensions/project.json b/src/Microsoft.AspNet.DataProtection.Extensions/project.json index 5c815caf43..5070099791 100644 --- a/src/Microsoft.AspNet.DataProtection.Extensions/project.json +++ b/src/Microsoft.AspNet.DataProtection.Extensions/project.json @@ -1,21 +1,23 @@ { - "version": "1.0.0-*", - "description": "Additional APIs for ASP.NET 5 data protection.", - "repository": { - "type": "git", - "url": "git://github.com/aspnet/dataprotection" + "version": "1.0.0-*", + "description": "Additional APIs for ASP.NET 5 data protection.", + "repository": { + "type": "git", + "url": "git://github.com/aspnet/dataprotection" + }, + "dependencies": { + "Microsoft.AspNet.DataProtection": "1.0.0-*", + "Microsoft.AspNet.DataProtection.Sources": { + "type": "build", + "version": "" }, - "dependencies": { - "Microsoft.AspNet.DataProtection": "1.0.0-*", - "Microsoft.AspNet.DataProtection.Sources": { "type": "build", "version": "" }, - "Microsoft.Extensions.DependencyInjection": "1.0.0-*" - }, - "frameworks": { - "net451": { }, - "dnx451": { }, - "dnxcore50": { } - }, - "compilationOptions": { - "warningsAsErrors": true - } -} + "Microsoft.Extensions.DependencyInjection": "1.0.0-*" + }, + "frameworks": { + "net451": {}, + "dotnet5.4": {} + }, + "compilationOptions": { + "warningsAsErrors": true + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.DataProtection.Sources/project.json b/src/Microsoft.AspNet.DataProtection.Sources/project.json index 57c8f34b7c..3417f84587 100644 --- a/src/Microsoft.AspNet.DataProtection.Sources/project.json +++ b/src/Microsoft.AspNet.DataProtection.Sources/project.json @@ -1,24 +1,22 @@ { - "version": "1.0.0-*", - "description": "ASP.NET 5 Data Protection shared code.", - "repository": { - "type": "git", - "url": "git://github.com/aspnet/dataprotection" - }, - "dependencies": { - }, - "frameworks": { - "net451": { }, - "dnx451": { }, - "dnxcore50": { - "dependencies": { - "System.Security.Cryptography.Primitives": "4.0.0-beta-*", - "System.Text.Encoding.Extensions": "4.0.11-beta-*" - } - } - }, - "shared": "**\\*.cs", - "compilationOptions": { - "warningsAsErrors": true + "version": "1.0.0-*", + "description": "ASP.NET 5 Data Protection shared code.", + "repository": { + "type": "git", + "url": "git://github.com/aspnet/dataprotection" + }, + "dependencies": {}, + "frameworks": { + "net451": {}, + "dotnet5.4": { + "dependencies": { + "System.Security.Cryptography.Primitives": "4.0.0-beta-*", + "System.Text.Encoding.Extensions": "4.0.11-beta-*" + } } -} + }, + "shared": "**\\*.cs", + "compilationOptions": { + "warningsAsErrors": true + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.DataProtection.SystemWeb/project.json b/src/Microsoft.AspNet.DataProtection.SystemWeb/project.json index 65738ec429..239f6b2ed0 100644 --- a/src/Microsoft.AspNet.DataProtection.SystemWeb/project.json +++ b/src/Microsoft.AspNet.DataProtection.SystemWeb/project.json @@ -1,27 +1,27 @@ { - "version": "1.0.0-*", - "description": "A component to allow the ASP.NET 5 DataProtection stack to work with the ASP.NET 4.x element.", - "repository": { - "type": "git", - "url": "git://github.com/aspnet/dataprotection" - }, - "frameworks": { - "net451": { - "dependencies": { - "Microsoft.AspNet.DataProtection": "1.0.0-*", - "Microsoft.Extensions.DependencyInjection": "1.0.0-*" - }, - "frameworkAssemblies": { - "System.Configuration": "4.0.0.0", - "System.Security": "4.0.0.0", - "System.Web": "4.0.0.0" - } - } - }, - "compilationOptions": { - "warningsAsErrors": true - }, - "packInclude": { - "content/net451/": "web.config.transform" + "version": "1.0.0-*", + "description": "A component to allow the ASP.NET 5 DataProtection stack to work with the ASP.NET 4.x element.", + "repository": { + "type": "git", + "url": "git://github.com/aspnet/dataprotection" + }, + "frameworks": { + "net451": { + "dependencies": { + "Microsoft.AspNet.DataProtection": "1.0.0-*", + "Microsoft.Extensions.DependencyInjection": "1.0.0-*" + }, + "frameworkAssemblies": { + "System.Configuration": "4.0.0.0", + "System.Security": "4.0.0.0", + "System.Web": "4.0.0.0" + } } -} + }, + "compilationOptions": { + "warningsAsErrors": true + }, + "packInclude": { + "content/net451/": "web.config.transform" + } +} \ No newline at end of file diff --git a/src/Microsoft.AspNet.DataProtection/AuthenticatedEncryption/ManagedAuthenticatedEncryptionOptions.cs b/src/Microsoft.AspNet.DataProtection/AuthenticatedEncryption/ManagedAuthenticatedEncryptionOptions.cs index 4751e893ec..c3bddbe552 100644 --- a/src/Microsoft.AspNet.DataProtection/AuthenticatedEncryption/ManagedAuthenticatedEncryptionOptions.cs +++ b/src/Microsoft.AspNet.DataProtection/AuthenticatedEncryption/ManagedAuthenticatedEncryptionOptions.cs @@ -126,7 +126,7 @@ namespace Microsoft.AspNet.DataProtection.AuthenticatedEncryption if (EncryptionAlgorithmType == typeof(Aes)) { Func factory = null; -#if !DNXCORE50 +#if !DOTNET5_4 if (OSVersionUtil.IsWindows()) { // If we're on desktop CLR and running on Windows, use the FIPS-compliant implementation. diff --git a/src/Microsoft.AspNet.DataProtection/Cng/DpapiSecretSerializerHelper.cs b/src/Microsoft.AspNet.DataProtection/Cng/DpapiSecretSerializerHelper.cs index ffb8a5c9fe..6fd62e9726 100644 --- a/src/Microsoft.AspNet.DataProtection/Cng/DpapiSecretSerializerHelper.cs +++ b/src/Microsoft.AspNet.DataProtection/Cng/DpapiSecretSerializerHelper.cs @@ -78,7 +78,7 @@ namespace Microsoft.AspNet.DataProtection.Cng }; DATA_BLOB dataOut = default(DATA_BLOB); -#if !DNXCORE50 +#if !DOTNET5_4 RuntimeHelpers.PrepareConstrainedRegions(); #endif try @@ -168,7 +168,7 @@ namespace Microsoft.AspNet.DataProtection.Cng fixed (byte* pbRetVal = retVal) { bool handleAcquired = false; -#if !DNXCORE50 +#if !DOTNET5_4 RuntimeHelpers.PrepareConstrainedRegions(); #endif try @@ -218,7 +218,7 @@ namespace Microsoft.AspNet.DataProtection.Cng }; DATA_BLOB dataOut = default(DATA_BLOB); -#if !DNXCORE50 +#if !DOTNET5_4 RuntimeHelpers.PrepareConstrainedRegions(); #endif try @@ -291,7 +291,7 @@ namespace Microsoft.AspNet.DataProtection.Cng using (unencryptedPayloadHandle) { bool handleAcquired = false; -#if !DNXCORE50 +#if !DOTNET5_4 RuntimeHelpers.PrepareConstrainedRegions(); #endif try diff --git a/src/Microsoft.AspNet.DataProtection/DataProtectionConfiguration.cs b/src/Microsoft.AspNet.DataProtection/DataProtectionConfiguration.cs index e083d1988a..5c53a1fdd1 100644 --- a/src/Microsoft.AspNet.DataProtection/DataProtectionConfiguration.cs +++ b/src/Microsoft.AspNet.DataProtection/DataProtectionConfiguration.cs @@ -11,7 +11,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Win32; -#if !DNXCORE50 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System.Security.Cryptography.X509Certificates; #endif @@ -183,7 +183,7 @@ namespace Microsoft.AspNet.DataProtection return this; } -#if !DNXCORE50 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !DOTNET5_4 // [[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.AspNet.DataProtection/DataProtectionServiceDescriptors.cs b/src/Microsoft.AspNet.DataProtection/DataProtectionServiceDescriptors.cs index 9e08c553a2..0e02d9e5eb 100644 --- a/src/Microsoft.AspNet.DataProtection/DataProtectionServiceDescriptors.cs +++ b/src/Microsoft.AspNet.DataProtection/DataProtectionServiceDescriptors.cs @@ -13,7 +13,7 @@ using Microsoft.AspNet.DataProtection.XmlEncryption; using Microsoft.Extensions.OptionsModel; using Microsoft.Win32; -#if !DNXCORE50 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !DOTNET5_4 // [[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 !DNXCORE50 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !DOTNET5_4 // [[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 !DNXCORE50 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml /// /// An backed by an X.509 certificate. diff --git a/src/Microsoft.AspNet.DataProtection/DataProtectionServices.cs b/src/Microsoft.AspNet.DataProtection/DataProtectionServices.cs index 5989631c4c..862aa06998 100644 --- a/src/Microsoft.AspNet.DataProtection/DataProtectionServices.cs +++ b/src/Microsoft.AspNet.DataProtection/DataProtectionServices.cs @@ -121,7 +121,7 @@ namespace Microsoft.Extensions.DependencyInjection yield return DataProtectionServiceDescriptors.IDataProtectionProvider_Default(); // Provide services required for XML encryption -#if !DNXCORE50 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml yield return DataProtectionServiceDescriptors.ICertificateResolver_Default(); #endif diff --git a/src/Microsoft.AspNet.DataProtection/Managed/ManagedAuthenticatedEncryptor.cs b/src/Microsoft.AspNet.DataProtection/Managed/ManagedAuthenticatedEncryptor.cs index b9c3724208..03841b485a 100644 --- a/src/Microsoft.AspNet.DataProtection/Managed/ManagedAuthenticatedEncryptor.cs +++ b/src/Microsoft.AspNet.DataProtection/Managed/ManagedAuthenticatedEncryptor.cs @@ -343,7 +343,7 @@ namespace Microsoft.AspNet.DataProtection.Managed using (var validationAlgorithm = CreateValidationAlgorithm(validationSubkey)) { -#if !DNXCORE50 +#if !DOTNET5_4 // As an optimization, avoid duplicating the underlying buffer if we're on desktop CLR. byte[] underlyingBuffer = outputStream.GetBuffer(); #else diff --git a/src/Microsoft.AspNet.DataProtection/Repositories/FileSystemXmlRepository.cs b/src/Microsoft.AspNet.DataProtection/Repositories/FileSystemXmlRepository.cs index becb107ac0..3cc94174a6 100644 --- a/src/Microsoft.AspNet.DataProtection/Repositories/FileSystemXmlRepository.cs +++ b/src/Microsoft.AspNet.DataProtection/Repositories/FileSystemXmlRepository.cs @@ -101,7 +101,7 @@ namespace Microsoft.AspNet.DataProtection.Repositories private static DirectoryInfo GetDefaultKeyStorageDirectory() { -#if !DNXCORE50 +#if !DOTNET5_4 // 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.AspNet.DataProtection/StringInterpolation.cs b/src/Microsoft.AspNet.DataProtection/StringInterpolation.cs index ce40ebed63..16f306bade 100644 --- a/src/Microsoft.AspNet.DataProtection/StringInterpolation.cs +++ b/src/Microsoft.AspNet.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 !DNXCORE50 +#if !DOTNET5_4 // 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.AspNet.DataProtection/XmlEncryption/CertificateResolver.cs b/src/Microsoft.AspNet.DataProtection/XmlEncryption/CertificateResolver.cs index 9ae11096bd..765e0d4e7f 100644 --- a/src/Microsoft.AspNet.DataProtection/XmlEncryption/CertificateResolver.cs +++ b/src/Microsoft.AspNet.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 !DNXCORE50 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System; using System.Security.Cryptography.X509Certificates; diff --git a/src/Microsoft.AspNet.DataProtection/XmlEncryption/CertificateXmlEncryptor.cs b/src/Microsoft.AspNet.DataProtection/XmlEncryption/CertificateXmlEncryptor.cs index f2a963d8cd..5cdfc505b3 100644 --- a/src/Microsoft.AspNet.DataProtection/XmlEncryption/CertificateXmlEncryptor.cs +++ b/src/Microsoft.AspNet.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 !DNXCORE50 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System; using System.Security.Cryptography.X509Certificates; diff --git a/src/Microsoft.AspNet.DataProtection/XmlEncryption/EncryptedXmlDecryptor.core50.cs b/src/Microsoft.AspNet.DataProtection/XmlEncryption/EncryptedXmlDecryptor.core50.cs index 5ea97ce76c..ce9c8ee9ff 100644 --- a/src/Microsoft.AspNet.DataProtection/XmlEncryption/EncryptedXmlDecryptor.core50.cs +++ b/src/Microsoft.AspNet.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 DNXCORE50 +#if DOTNET5_4 // [[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.AspNet.DataProtection/XmlEncryption/EncryptedXmlDecryptor.cs b/src/Microsoft.AspNet.DataProtection/XmlEncryption/EncryptedXmlDecryptor.cs index 51fbcefa0d..713f85f06c 100644 --- a/src/Microsoft.AspNet.DataProtection/XmlEncryption/EncryptedXmlDecryptor.cs +++ b/src/Microsoft.AspNet.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 !DNXCORE50 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System; using System.Security.Cryptography.Xml; diff --git a/src/Microsoft.AspNet.DataProtection/XmlEncryption/ICertificateResolver.cs b/src/Microsoft.AspNet.DataProtection/XmlEncryption/ICertificateResolver.cs index efc7e66b7b..5a6f0b9f27 100644 --- a/src/Microsoft.AspNet.DataProtection/XmlEncryption/ICertificateResolver.cs +++ b/src/Microsoft.AspNet.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 !DNXCORE50 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System.Security.Cryptography.X509Certificates; diff --git a/src/Microsoft.AspNet.DataProtection/XmlEncryption/IInternalCertificateXmlEncryptor.cs b/src/Microsoft.AspNet.DataProtection/XmlEncryption/IInternalCertificateXmlEncryptor.cs index c732e08eb4..ec30a73f44 100644 --- a/src/Microsoft.AspNet.DataProtection/XmlEncryption/IInternalCertificateXmlEncryptor.cs +++ b/src/Microsoft.AspNet.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 !DNXCORE50 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System; using System.Xml; diff --git a/src/Microsoft.AspNet.DataProtection/XmlEncryption/IInternalEncryptedXmlDecryptor.cs b/src/Microsoft.AspNet.DataProtection/XmlEncryption/IInternalEncryptedXmlDecryptor.cs index 223283de65..afc9a2092c 100644 --- a/src/Microsoft.AspNet.DataProtection/XmlEncryption/IInternalEncryptedXmlDecryptor.cs +++ b/src/Microsoft.AspNet.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 !DNXCORE50 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml +#if !DOTNET5_4 // [[ISSUE60]] Remove this #ifdef when Core CLR gets support for EncryptedXml using System; using System.Security.Cryptography.Xml; diff --git a/src/Microsoft.AspNet.DataProtection/XmlEncryption/XmlEncryptionExtensions.cs b/src/Microsoft.AspNet.DataProtection/XmlEncryption/XmlEncryptionExtensions.cs index ff2bd57cdd..f1987d1756 100644 --- a/src/Microsoft.AspNet.DataProtection/XmlEncryption/XmlEncryptionExtensions.cs +++ b/src/Microsoft.AspNet.DataProtection/XmlEncryption/XmlEncryptionExtensions.cs @@ -132,7 +132,7 @@ namespace Microsoft.AspNet.DataProtection.XmlEncryption var memoryStream = new MemoryStream(DEFAULT_BUFFER_SIZE); element.Save(memoryStream); -#if !DNXCORE50 +#if !DOTNET5_4 byte[] underlyingBuffer = memoryStream.GetBuffer(); fixed (byte* __unused__ = underlyingBuffer) // try to limit this moving around in memory while we allocate { diff --git a/src/Microsoft.AspNet.DataProtection/project.json b/src/Microsoft.AspNet.DataProtection/project.json index 4a634c02e7..fa1e0919e8 100644 --- a/src/Microsoft.AspNet.DataProtection/project.json +++ b/src/Microsoft.AspNet.DataProtection/project.json @@ -1,50 +1,45 @@ { - "version": "1.0.0-*", - "description": "ASP.NET 5 logic to protect and unprotect data, similar to DPAPI.", - "repository": { - "type": "git", - "url": "git://github.com/aspnet/dataprotection" + "version": "1.0.0-*", + "description": "ASP.NET 5 logic to protect and unprotect data, similar to DPAPI.", + "repository": { + "type": "git", + "url": "git://github.com/aspnet/dataprotection" + }, + "dependencies": { + "Microsoft.AspNet.Cryptography.Internal": "1.0.0-*", + "Microsoft.AspNet.DataProtection.Abstractions": "1.0.0-*", + "Microsoft.AspNet.DataProtection.Sources": { + "type": "build", + "version": "" }, - "dependencies": { - "Microsoft.AspNet.Cryptography.Internal": "1.0.0-*", - "Microsoft.AspNet.DataProtection.Abstractions": "1.0.0-*", - "Microsoft.AspNet.DataProtection.Sources": { "type": "build", "version": "" }, - "Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-*", - "Microsoft.Extensions.Logging.Abstractions": "1.0.0-*", - "Microsoft.Extensions.OptionsModel": "1.0.0-*" + "Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-*", + "Microsoft.Extensions.Logging.Abstractions": "1.0.0-*", + "Microsoft.Extensions.OptionsModel": "1.0.0-*" + }, + "frameworks": { + "net451": { + "frameworkAssemblies": { + "System.IO": "", + "System.Security": "", + "System.Xml": "", + "System.Xml.Linq": "" + } }, - "frameworks": { - "net451": { - "frameworkAssemblies": { - "System.IO": "", - "System.Security": "", - "System.Xml": "", - "System.Xml.Linq": "" - } - }, - "dnx451": { - "frameworkAssemblies": { - "System.IO": "", - "System.Security": "", - "System.Xml": "", - "System.Xml.Linq": "" - } - }, - "dnxcore50": { - "dependencies": { - "Microsoft.Win32.Registry": "4.0.0-beta-*", - "System.Linq": "4.0.1-beta-*", - "System.Reflection.Extensions": "4.0.1-beta-*", - "System.Reflection.TypeExtensions": "4.0.1-beta-*", - "System.Security.Cryptography.X509Certificates": "4.0.0-beta-*", - "System.Security.Claims": "4.0.1-beta-*", - "System.Security.Principal.Windows": "4.0.0-beta-*", - "System.Xml.XDocument": "4.0.11-beta-*" - } - } - }, - "compilationOptions": { - "allowUnsafe": true, - "warningsAsErrors": true + "dotnet5.4": { + "dependencies": { + "Microsoft.Win32.Registry": "4.0.0-beta-*", + "System.Linq": "4.0.1-beta-*", + "System.Reflection.Extensions": "4.0.1-beta-*", + "System.Reflection.TypeExtensions": "4.0.1-beta-*", + "System.Security.Cryptography.X509Certificates": "4.0.0-beta-*", + "System.Security.Claims": "4.0.1-beta-*", + "System.Security.Principal.Windows": "4.0.0-beta-*", + "System.Xml.XDocument": "4.0.11-beta-*" + } } -} + }, + "compilationOptions": { + "allowUnsafe": true, + "warningsAsErrors": true + } +} \ No newline at end of file