Remove net451 as a cross-compile target
This commit is contained in:
parent
bb7b58321c
commit
91406009d3
|
|
@ -28,4 +28,5 @@ project.lock.json
|
|||
.vs
|
||||
.build/
|
||||
.testPublish/
|
||||
samples/**/temp-keys/
|
||||
samples/**/temp-keys/
|
||||
global.json
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<Import Project="..\..\build\dependencies.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net451;netcoreapp2.0</TargetFrameworks>
|
||||
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<Import Project="..\..\build\dependencies.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net451;netcoreapp2.0</TargetFrameworks>
|
||||
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<Import Project="..\..\build\dependencies.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net451;netcoreapp2.0</TargetFrameworks>
|
||||
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<Import Project="..\..\build\dependencies.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.0;net451</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<Description>Infrastructure for ASP.NET Core cryptographic packages. Applications and libraries should not reference this package directly.</Description>
|
||||
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
|
||||
<TargetFrameworks>net46;netstandard1.3</TargetFrameworks>
|
||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
|
|
|
|||
|
|
@ -24,4 +24,7 @@ namespace Microsoft.Win32.SafeHandles
|
|||
}
|
||||
}
|
||||
}
|
||||
#elif NET46
|
||||
#else
|
||||
#error target frameworks need to be updated.
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<Description>ASP.NET Core utilities for key derivation.</Description>
|
||||
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
|
||||
<TargetFramework>netstandard1.3</TargetFramework>
|
||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
Commonly used types:
|
||||
Microsoft.AspNetCore.DataProtection.IDataProtectionProvider
|
||||
Microsoft.AspNetCore.DataProtection.IDataProtector</Description>
|
||||
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
|
||||
<TargetFramework>netstandard1.3</TargetFramework>
|
||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PackageTags>aspnetcore;dataprotection</PackageTags>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<PropertyGroup>
|
||||
<Description>Microsoft Azure Blob storrage support as key store.</Description>
|
||||
<VersionPrefix>1.1.0</VersionPrefix>
|
||||
<TargetFrameworks>net451;netstandard1.5</TargetFrameworks>
|
||||
<TargetFrameworks>net46;netstandard1.5</TargetFrameworks>
|
||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
/// <summary>
|
||||
/// Creates a <see cref="DataProtectionProvider"/> that store keys in a location based on
|
||||
/// the platform and operating system and uses the given <see cref="X509Certificate2"/> 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);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<Description>Additional APIs for ASP.NET Core data protection.</Description>
|
||||
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
|
||||
<TargetFrameworks>net46;netstandard1.3</TargetFrameworks>
|
||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PackageTags>aspnetcore;dataprotection</PackageTags>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<PropertyGroup>
|
||||
<Description>Redis storrage support as key store.</Description>
|
||||
<VersionPrefix>0.1.0</VersionPrefix>
|
||||
<TargetFrameworks>net451;netstandard1.5</TargetFrameworks>
|
||||
<TargetFrameworks>net46;netstandard1.5</TargetFrameworks>
|
||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<Description>A component to allow the ASP.NET Core data protection stack to work with the ASP.NET 4.x <machineKey> element.</Description>
|
||||
<TargetFramework>net451</TargetFramework>
|
||||
<TargetFramework>net46</TargetFramework>
|
||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PackageTags>aspnet;aspnetcore;dataprotection</PackageTags>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="web.config.transform" PackagePath="content/net451/" Pack="true" />
|
||||
<Content Include="web.config.transform" PackagePath="content/net46/" Pack="true" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -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<ICertificateResolver, CertificateResolver>();
|
||||
#elif NETSTANDARD1_3
|
||||
#else
|
||||
#error target frameworks need to be updated.
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using Microsoft.Extensions.DependencyInjection;
|
|||
|
||||
namespace Microsoft.AspNetCore.DataProtection
|
||||
{
|
||||
#if !NETSTANDARD1_3
|
||||
#if NET46
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
#else
|
||||
#elif NETSTANDARD1_3
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
#else
|
||||
#error target frameworks need to be updated.
|
||||
#endif
|
||||
public interface IDataProtectionBuilder
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<Description>ASP.NET Core logic to protect and unprotect data, similar to DPAPI.</Description>
|
||||
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
|
||||
<TargetFrameworks>net46;netstandard1.3</TargetFrameworks>
|
||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
<PackageReference Include="Microsoft.Extensions.Options" Version="$(AspNetCoreVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
|
||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -38,5 +38,7 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#elif NET46
|
||||
#else
|
||||
#error target frameworks need to be updated.
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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<byte> 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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,9 @@
|
|||
<Import Project="..\..\build\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(PackageTargetFallback);dnxcore50;portable-net451+win8</PackageTargetFallback>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<Import Project="..\..\build\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<Import Project="..\..\build\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<Import Project="..\..\build\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(PackageTargetFallback);dnxcore50;portable-net451+win8</PackageTargetFallback>
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<Import Project="..\..\build\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<Import Project="..\..\build\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
<Import Project="..\..\build\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
|
||||
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
<PackageReference Include="xunit" Version="$(XunitVersion)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='net452'">
|
||||
<ItemGroup Condition="'$(TargetFramework)'=='net46'">
|
||||
<Reference Include="System.Security" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue