Update aspnet50/aspnetcore50 => dnx451/dnxcore50.

This commit is contained in:
N. Taylor Mullen 2015-03-08 12:48:15 -07:00
parent 88eb10dcfe
commit cb5e7d82f9
21 changed files with 62 additions and 62 deletions

View File

@ -7,7 +7,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
#if !ASPNETCORE50
#if !DNXCORE50
using System.Runtime.ConstrainedExecution;
#endif
@ -53,7 +53,7 @@ namespace Microsoft.AspNet.Cryptography
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
#if !ASPNETCORE50
#if !DNXCORE50
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#endif
public static bool TimeConstantBuffersAreEqual(byte* bufA, byte* bufB, uint count)

View File

@ -4,7 +4,7 @@
using System;
using System.Runtime.InteropServices;
#if ASPNETCORE50
#if DNXCORE50
namespace Microsoft.Win32.SafeHandles
{
internal abstract class SafeHandleZeroOrMinusOneIsInvalid : SafeHandle

View File

@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
using System.Security;
using Microsoft.Win32.SafeHandles;
#if !ASPNETCORE50
#if !DNXCORE50
using System.Runtime.ConstrainedExecution;
#endif
@ -127,12 +127,12 @@ namespace Microsoft.AspNet.Cryptography.SafeHandles
return UnsafeNativeMethods.FreeLibrary(handle);
}
#if !ASPNETCORE50
#if !DNXCORE50
[SuppressUnmanagedCodeSecurity]
#endif
private static class UnsafeNativeMethods
{
#if ASPNETCORE50
#if DNXCORE50
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 ASPNETCORE50
#if DNXCORE50
[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 ASPNETCORE50
#if DNXCORE50
[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 ASPNETCORE50
#if DNXCORE50
[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 ASPNETCORE50
#if DNXCORE50
[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 ASPNETCORE50
#if DNXCORE50
[DllImport(CORE_LIBRARY_LOADER_LIB, EntryPoint = "LoadLibraryExW", CallingConvention = CallingConvention.Winapi, SetLastError = true)]
#else
[DllImport(KERNEL32_LIB, EntryPoint = "LoadLibraryExW", CallingConvention = CallingConvention.Winapi, SetLastError = true)]

View File

@ -5,7 +5,7 @@ using System;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;
#if ASPNETCORE50
#if DNXCORE50
namespace Microsoft.AspNet.Cryptography.SafeHandles
{
/// <summary>

View File

@ -6,7 +6,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
#if !ASPNETCORE50
#if !DNXCORE50
using System.Runtime.ConstrainedExecution;
#endif
@ -43,7 +43,7 @@ namespace Microsoft.AspNet.Cryptography.SafeHandles
return newHandle;
}
#if !ASPNETCORE50
#if !DNXCORE50
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
#endif
private void AllocateImpl(IntPtr cb)

View File

@ -6,7 +6,7 @@ using System.Runtime.CompilerServices;
using System.Threading;
using Microsoft.AspNet.Cryptography.SafeHandles;
#if !ASPNETCORE50
#if !DNXCORE50
using System.Runtime.ConstrainedExecution;
#endif
@ -17,7 +17,7 @@ namespace Microsoft.AspNet.Cryptography
private static readonly byte[] _emptyArray = new byte[0];
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#if !ASPNETCORE50
#if !DNXCORE50
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#endif
public static void BlockCopy(void* from, void* to, int byteCount)
@ -26,7 +26,7 @@ namespace Microsoft.AspNet.Cryptography
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#if !ASPNETCORE50
#if !DNXCORE50
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#endif
public static void BlockCopy(void* from, void* to, uint byteCount)
@ -37,7 +37,7 @@ namespace Microsoft.AspNet.Cryptography
}
}
#if !ASPNETCORE50
#if !DNXCORE50
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
#endif
public static void BlockCopy(LocalAllocHandle from, void* to, uint byteCount)
@ -57,7 +57,7 @@ namespace Microsoft.AspNet.Cryptography
}
}
#if !ASPNETCORE50
#if !DNXCORE50
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
#endif
public static void BlockCopy(byte* from, LocalAllocHandle to, uint byteCount)
@ -77,7 +77,7 @@ namespace Microsoft.AspNet.Cryptography
}
}
#if !ASPNETCORE50
#if !DNXCORE50
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
#endif
public static void BlockCopy(LocalAllocHandle from, LocalAllocHandle to, IntPtr length)
@ -117,7 +117,7 @@ namespace Microsoft.AspNet.Cryptography
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static void BlockCopyImpl(byte* from, byte* to, uint byteCount)
{
#if ASPNETCORE50
#if DNXCORE50
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 BlockCopyImpl(byte* from, byte* to, ulong byteCount)
{
#if ASPNETCORE50
#if DNXCORE50
Buffer.MemoryCopy(from, to, byteCount, byteCount);
#else
while (byteCount-- != 0) {
@ -142,7 +142,7 @@ namespace Microsoft.AspNet.Cryptography
/// Securely clears a memory buffer.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#if !ASPNETCORE50
#if !DNXCORE50
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#endif
public static void SecureZeroMemory(byte* buffer, int byteCount)
@ -154,7 +154,7 @@ namespace Microsoft.AspNet.Cryptography
/// Securely clears a memory buffer.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#if !ASPNETCORE50
#if !DNXCORE50
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#endif
public static void SecureZeroMemory(byte* buffer, uint byteCount)
@ -175,7 +175,7 @@ namespace Microsoft.AspNet.Cryptography
/// Securely clears a memory buffer.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
#if !ASPNETCORE50
#if !DNXCORE50
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#endif
public static void SecureZeroMemory(byte* buffer, ulong byteCount)
@ -195,7 +195,7 @@ namespace Microsoft.AspNet.Cryptography
/// <summary>
/// Securely clears a memory buffer.
/// </summary>
#if !ASPNETCORE50
#if !DNXCORE50
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#endif
public static void SecureZeroMemory(byte* buffer, IntPtr length)

View File

@ -12,13 +12,13 @@ using Microsoft.AspNet.Cryptography.Cng;
using Microsoft.AspNet.Cryptography.SafeHandles;
using Microsoft.Win32.SafeHandles;
#if !ASPNETCORE50
#if !DNXCORE50
using System.Runtime.ConstrainedExecution;
#endif
namespace Microsoft.AspNet.Cryptography
{
#if !ASPNETCORE50
#if !DNXCORE50
[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 !ASPNETCORE50
#if !DNXCORE50
[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 !ASPNETCORE50
#if !DNXCORE50
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#endif
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa375404(v=vs.85).aspx
@ -202,7 +202,7 @@ namespace Microsoft.AspNet.Cryptography
*/
[DllImport(CRYPT32_LIB, CallingConvention = CallingConvention.Winapi)]
#if !ASPNETCORE50
#if !DNXCORE50
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#endif
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa376045(v=vs.85).aspx
@ -210,7 +210,7 @@ namespace Microsoft.AspNet.Cryptography
[In] IntPtr pCertContext);
[DllImport(CRYPT32_LIB, CallingConvention = CallingConvention.Winapi)]
#if !ASPNETCORE50
#if !DNXCORE50
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#endif
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa376075(v=vs.85).aspx
@ -227,7 +227,7 @@ namespace Microsoft.AspNet.Cryptography
[DllImport(CRYPT32_LIB, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa379885(v=vs.85).aspx
#if !ASPNETCORE50
#if !DNXCORE50
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
#endif
internal static extern bool CryptAcquireCertificatePrivateKey(
@ -286,7 +286,7 @@ namespace Microsoft.AspNet.Cryptography
*/
[DllImport(NCRYPT_LIB, CallingConvention = CallingConvention.Winapi)]
#if !ASPNETCORE50
#if !DNXCORE50
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#endif
// http://msdn.microsoft.com/en-us/library/windows/desktop/hh706799(v=vs.85).aspx

View File

@ -1,12 +1,12 @@
{
{
"version": "1.0.0-*",
"description": "Infrastructure for ASP.NET 5 cryptographic packages. Developers should not reference this package.",
"dependencies": {
},
"frameworks": {
"net451": { },
"aspnet50": { },
"aspnetcore50": {
"dnx451": { },
"dnxcore50": {
"dependencies": {
"System.Diagnostics.Debug": "4.0.10-beta-*",
"System.Globalization": "4.0.10-beta-*",

View File

@ -1,4 +1,4 @@
{
{
"version": "1.0.0-*",
"description": "ASP.NET 5 utilities for key derivation.",
"dependencies": {
@ -6,8 +6,8 @@
},
"frameworks": {
"net451": { },
"aspnet50": { },
"aspnetcore50": {
"dnx451": { },
"dnxcore50": {
"dependencies": {
"System.Runtime.Extensions": "4.0.10-beta-*",
"System.Security.Cryptography.Hashing.Algorithms": "4.0.0-beta-*"

View File

@ -1,4 +1,4 @@
{
{
"version": "1.0.0-*",
"description": "ASP.NET 5 blob storage repository for DataProtection.",
"dependencies": {
@ -7,7 +7,7 @@
},
"frameworks": {
"net451": {},
"aspnet50": {}
"dnx451": {}
},
"compilationOptions": {
"warningsAsErrors": true

View File

@ -62,7 +62,7 @@ namespace Microsoft.AspNet.DataProtection.Cng
};
DATA_BLOB dataOut = default(DATA_BLOB);
#if !ASPNETCORE50
#if !DNXCORE50
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
@ -152,7 +152,7 @@ namespace Microsoft.AspNet.DataProtection.Cng
fixed (byte* pbRetVal = retVal)
{
bool handleAcquired = false;
#if !ASPNETCORE50
#if !DNXCORE50
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
@ -202,7 +202,7 @@ namespace Microsoft.AspNet.DataProtection.Cng
};
DATA_BLOB dataOut = default(DATA_BLOB);
#if !ASPNETCORE50
#if !DNXCORE50
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try
@ -275,7 +275,7 @@ namespace Microsoft.AspNet.DataProtection.Cng
using (unencryptedPayloadHandle)
{
bool handleAcquired = false;
#if !ASPNETCORE50
#if !DNXCORE50
RuntimeHelpers.PrepareConstrainedRegions();
#endif
try

View File

@ -124,7 +124,7 @@ namespace Microsoft.Framework.DependencyInjection
private static DirectoryInfo TryGetLocalAppDataKeysFolderForUser()
{
#if !ASPNETCORE50
#if !DNXCORE50
// Environment.GetFolderPath returns null if the user profile isn't loaded.
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
if (!String.IsNullOrEmpty(folderPath))

View File

@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// We only define this type in core CLR since desktop CLR already contains it.
#if ASPNETCORE50
#if DNXCORE50
using System;
namespace System.Security.Cryptography

View File

@ -11,7 +11,7 @@ namespace Microsoft.AspNet.DataProtection.Dpapi
{
public byte[] Protect(byte[] userData, byte[] optionalEntropy, DataProtectionScope scope)
{
#if ASPNETCORE50
#if DNXCORE50
fixed (byte* pbUserData = userData)
{
fixed (byte* pbOptionalEntropy = optionalEntropy)
@ -31,7 +31,7 @@ namespace Microsoft.AspNet.DataProtection.Dpapi
public byte[] Unprotect(byte[] encryptedData, byte[] optionalEntropy, DataProtectionScope scope)
{
#if ASPNETCORE50
#if DNXCORE50
Secret blob;
fixed (byte* pbEncryptedData = encryptedData)
{

View File

@ -357,7 +357,7 @@ namespace Microsoft.AspNet.DataProtection.Managed
using (var validationAlgorithm = CreateValidationAlgorithm(validationSubkey))
{
#if !ASPNETCORE50
#if !DNXCORE50
// As an optimization, avoid duplicating the underlying buffer if we're on desktop CLR.
byte[] underlyingBuffer = outputStream.GetBuffer();
#else

View File

@ -51,7 +51,7 @@ namespace Microsoft.AspNet.DataProtection.XmlEncryption
using (var memoryStream = new MemoryStream())
{
plaintextElement.Save(memoryStream);
#if !ASPNETCORE50
#if !DNXCORE50
// If we're on full desktop CLR, utilize the underlying buffer directly as an optimization.
byte[] underlyingBuffer = memoryStream.GetBuffer();
secret = new Secret(new ArraySegment<byte>(underlyingBuffer, 0, checked((int)memoryStream.Length)));

View File

@ -36,7 +36,7 @@ namespace Microsoft.AspNet.DataProtection.XmlEncryption
{
plaintextElement.Save(memoryStream);
#if !ASPNETCORE50
#if !DNXCORE50
// If we're on full desktop CLR, utilize the underlying buffer directly as an optimization.
byte[] underlyingBuffer = memoryStream.GetBuffer();
secret = new Secret(new ArraySegment<byte>(underlyingBuffer, 0, checked((int)memoryStream.Length)));

View File

@ -1,4 +1,4 @@
{
{
"version": "1.0.0-*",
"description": "ASP.NET 5 logic to protect and unprotect data, similar to DPAPI.",
"dependencies": {
@ -14,14 +14,14 @@
"System.Xml.Linq": ""
}
},
"aspnet50": {
"dnx451": {
"frameworkAssemblies": {
"System.Security": "",
"System.Xml": "",
"System.Xml.Linq": ""
}
},
"aspnetcore50": {
"dnxcore50": {
"dependencies": {
"Microsoft.Win32.Registry": "4.0.0-beta-*",
"System.IO": "4.0.10-beta-*",

View File

@ -1,11 +1,11 @@
{
{
"dependencies": {
"Microsoft.AspNet.Cryptography.Internal": "1.0.0-*",
"Microsoft.AspNet.Testing": "1.0.0-*",
"xunit.runner.kre": "1.0.0-*"
},
"frameworks": {
"aspnet50": { }
"dnx451": { }
},
"commands": {
"test": "xunit.runner.kre"

View File

@ -1,4 +1,4 @@
{
{
"dependencies": {
"Microsoft.AspNet.Cryptography.Internal": "1.0.0-*",
"Microsoft.AspNet.Cryptography.KeyDerivation": "1.0.0-*",
@ -7,7 +7,7 @@
"xunit.runner.kre": "1.0.0-*"
},
"frameworks": {
"aspnet50": { }
"dnx451": { }
},
"commands": {
"test": "xunit.runner.kre"

View File

@ -1,4 +1,4 @@
{
{
"dependencies": {
"Microsoft.AspNet.DataProtection": "1.0.0-*",
"Microsoft.AspNet.Testing": "1.0.0-*",
@ -6,7 +6,7 @@
"xunit.runner.kre": "1.0.0-*"
},
"frameworks": {
"aspnet50": { }
"dnx451": { }
},
"commands": {
"test": "xunit.runner.kre"