Remove net451 as a cross-compile target
This commit is contained in:
parent
bb7b58321c
commit
91406009d3
|
|
@ -29,3 +29,4 @@ project.lock.json
|
||||||
.build/
|
.build/
|
||||||
.testPublish/
|
.testPublish/
|
||||||
samples/**/temp-keys/
|
samples/**/temp-keys/
|
||||||
|
global.json
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<Import Project="..\..\build\dependencies.props" />
|
<Import Project="..\..\build\dependencies.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net451;netcoreapp2.0</TargetFrameworks>
|
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<Import Project="..\..\build\dependencies.props" />
|
<Import Project="..\..\build\dependencies.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net451;netcoreapp2.0</TargetFrameworks>
|
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<Import Project="..\..\build\dependencies.props" />
|
<Import Project="..\..\build\dependencies.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net451;netcoreapp2.0</TargetFrameworks>
|
<TargetFrameworks>net46;netcoreapp2.0</TargetFrameworks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<Import Project="..\..\build\dependencies.props" />
|
<Import Project="..\..\build\dependencies.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netcoreapp2.0;net451</TargetFrameworks>
|
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -73,8 +73,11 @@ namespace Microsoft.AspNetCore.Cryptography
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
|
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
|
||||||
#if !NETSTANDARD1_3
|
#if NET46
|
||||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||||
|
#elif NETSTANDARD1_3
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
public static bool TimeConstantBuffersAreEqual(byte* bufA, byte* bufB, uint count)
|
public static bool TimeConstantBuffersAreEqual(byte* bufA, byte* bufB, uint count)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>Infrastructure for ASP.NET Core cryptographic packages. Applications and libraries should not reference this package directly.</Description>
|
<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>
|
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
|
|
||||||
|
|
@ -24,4 +24,7 @@ namespace Microsoft.Win32.SafeHandles
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#elif NET46
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -127,23 +127,30 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles
|
||||||
return UnsafeNativeMethods.FreeLibrary(handle);
|
return UnsafeNativeMethods.FreeLibrary(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !NETSTANDARD1_3
|
#if NET46
|
||||||
[SuppressUnmanagedCodeSecurity]
|
[SuppressUnmanagedCodeSecurity]
|
||||||
|
#elif NETSTANDARD1_3
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
private static class UnsafeNativeMethods
|
private static class UnsafeNativeMethods
|
||||||
{
|
{
|
||||||
#if NETSTANDARD1_3
|
#if NETSTANDARD1_3
|
||||||
private const string CORE_LIBRARY_LOADER_LIB = "api-ms-win-core-libraryloader-l1-1-0.dll";
|
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";
|
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";
|
private const string KERNEL32_LIB = "kernel32.dll";
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms679351(v=vs.85).aspx
|
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms679351(v=vs.85).aspx
|
||||||
#if NETSTANDARD1_3
|
#if NETSTANDARD1_3
|
||||||
[DllImport(CORE_LOCALIZATION_LIB, EntryPoint = "FormatMessageW", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, SetLastError = true)]
|
[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)]
|
[DllImport(KERNEL32_LIB, EntryPoint = "FormatMessageW", CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode, SetLastError = true)]
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
public static extern int FormatMessage(
|
public static extern int FormatMessage(
|
||||||
[In] uint dwFlags,
|
[In] uint dwFlags,
|
||||||
|
|
@ -159,9 +166,11 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
#if NETSTANDARD1_3
|
#if NETSTANDARD1_3
|
||||||
[DllImport(CORE_LIBRARY_LOADER_LIB, CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode)]
|
[DllImport(CORE_LIBRARY_LOADER_LIB, CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode)]
|
||||||
#else
|
#elif NET46
|
||||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||||
[DllImport(KERNEL32_LIB, CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode)]
|
[DllImport(KERNEL32_LIB, CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Unicode)]
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
internal static extern bool FreeLibrary(IntPtr hModule);
|
internal static extern bool FreeLibrary(IntPtr hModule);
|
||||||
|
|
||||||
|
|
@ -169,8 +178,10 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
#if NETSTANDARD1_3
|
#if NETSTANDARD1_3
|
||||||
[DllImport(CORE_LIBRARY_LOADER_LIB, EntryPoint = "GetModuleHandleExW", CallingConvention = CallingConvention.Winapi, SetLastError = true)]
|
[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)]
|
[DllImport(KERNEL32_LIB, EntryPoint = "GetModuleHandleExW", CallingConvention = CallingConvention.Winapi, SetLastError = true)]
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
internal static extern bool GetModuleHandleEx(
|
internal static extern bool GetModuleHandleEx(
|
||||||
[In] uint dwFlags,
|
[In] uint dwFlags,
|
||||||
|
|
@ -180,8 +191,10 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles
|
||||||
// http://msdn.microsoft.com/en-us/library/ms683212(v=vs.85).aspx
|
// http://msdn.microsoft.com/en-us/library/ms683212(v=vs.85).aspx
|
||||||
#if NETSTANDARD1_3
|
#if NETSTANDARD1_3
|
||||||
[DllImport(CORE_LIBRARY_LOADER_LIB, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
|
[DllImport(CORE_LIBRARY_LOADER_LIB, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
|
||||||
#else
|
#elif NET46
|
||||||
[DllImport(KERNEL32_LIB, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
|
[DllImport(KERNEL32_LIB, CallingConvention = CallingConvention.Winapi, SetLastError = true)]
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
internal static extern IntPtr GetProcAddress(
|
internal static extern IntPtr GetProcAddress(
|
||||||
[In] SafeLibraryHandle hModule,
|
[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
|
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx
|
||||||
#if NETSTANDARD1_3
|
#if NETSTANDARD1_3
|
||||||
[DllImport(CORE_LIBRARY_LOADER_LIB, EntryPoint = "LoadLibraryExW", CallingConvention = CallingConvention.Winapi, SetLastError = true)]
|
[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)]
|
[DllImport(KERNEL32_LIB, EntryPoint = "LoadLibraryExW", CallingConvention = CallingConvention.Winapi, SetLastError = true)]
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
internal static extern SafeLibraryHandle LoadLibraryEx(
|
internal static extern SafeLibraryHandle LoadLibraryEx(
|
||||||
[In, MarshalAs(UnmanagedType.LPWStr)] string lpFileName,
|
[In, MarshalAs(UnmanagedType.LPWStr)] string lpFileName,
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,11 @@ namespace Microsoft.AspNetCore.Cryptography.SafeHandles
|
||||||
return newHandle;
|
return newHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !NETSTANDARD1_3
|
#if NET46
|
||||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
|
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
|
||||||
|
#elif NETSTANDARD1_3
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
private void AllocateImpl(IntPtr cb)
|
private void AllocateImpl(IntPtr cb)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -12,14 +12,17 @@ using Microsoft.AspNetCore.Cryptography.Cng;
|
||||||
using Microsoft.AspNetCore.Cryptography.SafeHandles;
|
using Microsoft.AspNetCore.Cryptography.SafeHandles;
|
||||||
using Microsoft.Win32.SafeHandles;
|
using Microsoft.Win32.SafeHandles;
|
||||||
|
|
||||||
#if !NETSTANDARD1_3
|
#if NET46
|
||||||
using System.Runtime.ConstrainedExecution;
|
using System.Runtime.ConstrainedExecution;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Cryptography
|
namespace Microsoft.AspNetCore.Cryptography
|
||||||
{
|
{
|
||||||
#if !NETSTANDARD1_3
|
#if NET46
|
||||||
[SuppressUnmanagedCodeSecurity]
|
[SuppressUnmanagedCodeSecurity]
|
||||||
|
#elif NETSTANDARD1_3
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
internal unsafe static class UnsafeNativeMethods
|
internal unsafe static class UnsafeNativeMethods
|
||||||
{
|
{
|
||||||
|
|
@ -87,16 +90,22 @@ namespace Microsoft.AspNetCore.Cryptography
|
||||||
[In] uint dwFlags);
|
[In] uint dwFlags);
|
||||||
|
|
||||||
[DllImport(BCRYPT_LIB, CallingConvention = CallingConvention.Winapi)]
|
[DllImport(BCRYPT_LIB, CallingConvention = CallingConvention.Winapi)]
|
||||||
#if !NETSTANDARD1_3
|
#if NET46
|
||||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||||
|
#elif NETSTANDARD1_3
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa375399(v=vs.85).aspx
|
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa375399(v=vs.85).aspx
|
||||||
internal static extern int BCryptDestroyHash(
|
internal static extern int BCryptDestroyHash(
|
||||||
[In] IntPtr hHash);
|
[In] IntPtr hHash);
|
||||||
|
|
||||||
[DllImport(BCRYPT_LIB, CallingConvention = CallingConvention.Winapi)]
|
[DllImport(BCRYPT_LIB, CallingConvention = CallingConvention.Winapi)]
|
||||||
#if !NETSTANDARD1_3
|
#if NET46
|
||||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||||
|
#elif NETSTANDARD1_3
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa375404(v=vs.85).aspx
|
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa375404(v=vs.85).aspx
|
||||||
internal static extern int BCryptDestroyKey(
|
internal static extern int BCryptDestroyKey(
|
||||||
|
|
@ -249,8 +258,11 @@ namespace Microsoft.AspNetCore.Cryptography
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[DllImport(NCRYPT_LIB, CallingConvention = CallingConvention.Winapi)]
|
[DllImport(NCRYPT_LIB, CallingConvention = CallingConvention.Winapi)]
|
||||||
#if !NETSTANDARD1_3
|
#if NET46
|
||||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||||
|
#elif NETSTANDARD1_3
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
// http://msdn.microsoft.com/en-us/library/windows/desktop/hh706799(v=vs.85).aspx
|
// http://msdn.microsoft.com/en-us/library/windows/desktop/hh706799(v=vs.85).aspx
|
||||||
internal static extern int NCryptCloseProtectionDescriptor(
|
internal static extern int NCryptCloseProtectionDescriptor(
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>ASP.NET Core utilities for key derivation.</Description>
|
<Description>ASP.NET Core utilities for key derivation.</Description>
|
||||||
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
|
<TargetFramework>netstandard1.3</TargetFramework>
|
||||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
Commonly used types:
|
Commonly used types:
|
||||||
Microsoft.AspNetCore.DataProtection.IDataProtectionProvider
|
Microsoft.AspNetCore.DataProtection.IDataProtectionProvider
|
||||||
Microsoft.AspNetCore.DataProtection.IDataProtector</Description>
|
Microsoft.AspNetCore.DataProtection.IDataProtector</Description>
|
||||||
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
|
<TargetFramework>netstandard1.3</TargetFramework>
|
||||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>aspnetcore;dataprotection</PackageTags>
|
<PackageTags>aspnetcore;dataprotection</PackageTags>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>Microsoft Azure Blob storrage support as key store.</Description>
|
<Description>Microsoft Azure Blob storrage support as key store.</Description>
|
||||||
<VersionPrefix>1.1.0</VersionPrefix>
|
<VersionPrefix>1.1.0</VersionPrefix>
|
||||||
<TargetFrameworks>net451;netstandard1.5</TargetFrameworks>
|
<TargetFrameworks>net46;netstandard1.5</TargetFrameworks>
|
||||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ namespace Microsoft.AspNetCore.DataProtection
|
||||||
return CreateProvider(keyDirectory, setupAction, certificate: null);
|
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>
|
/// <summary>
|
||||||
/// Creates a <see cref="DataProtectionProvider"/> that store keys in a location based on
|
/// 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.
|
/// 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);
|
return CreateProvider(keyDirectory, setupAction, certificate);
|
||||||
}
|
}
|
||||||
|
#elif NETSTANDARD1_3
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private static IDataProtectionProvider CreateProvider(
|
private static IDataProtectionProvider CreateProvider(
|
||||||
|
|
@ -166,11 +169,14 @@ namespace Microsoft.AspNetCore.DataProtection
|
||||||
builder.PersistKeysToFileSystem(keyDirectory);
|
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)
|
if (certificate != null)
|
||||||
{
|
{
|
||||||
builder.ProtectKeysWithCertificate(certificate);
|
builder.ProtectKeysWithCertificate(certificate);
|
||||||
}
|
}
|
||||||
|
#elif NETSTANDARD1_3
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
setupAction(builder);
|
setupAction(builder);
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>Additional APIs for ASP.NET Core data protection.</Description>
|
<Description>Additional APIs for ASP.NET Core data protection.</Description>
|
||||||
<TargetFrameworks>net451;netstandard1.3</TargetFrameworks>
|
<TargetFrameworks>net46;netstandard1.3</TargetFrameworks>
|
||||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>aspnetcore;dataprotection</PackageTags>
|
<PackageTags>aspnetcore;dataprotection</PackageTags>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>Redis storrage support as key store.</Description>
|
<Description>Redis storrage support as key store.</Description>
|
||||||
<VersionPrefix>0.1.0</VersionPrefix>
|
<VersionPrefix>0.1.0</VersionPrefix>
|
||||||
<TargetFrameworks>net451;netstandard1.5</TargetFrameworks>
|
<TargetFrameworks>net46;netstandard1.5</TargetFrameworks>
|
||||||
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,14 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>A component to allow the ASP.NET Core data protection stack to work with the ASP.NET 4.x <machineKey> element.</Description>
|
<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>
|
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<PackageTags>aspnet;aspnetcore;dataprotection</PackageTags>
|
<PackageTags>aspnet;aspnetcore;dataprotection</PackageTags>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="web.config.transform" PackagePath="content/net451/" Pack="true" />
|
<Content Include="web.config.transform" PackagePath="content/net46/" Pack="true" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -78,8 +78,11 @@ namespace Microsoft.AspNetCore.DataProtection.Cng
|
||||||
};
|
};
|
||||||
var dataOut = default(DATA_BLOB);
|
var dataOut = default(DATA_BLOB);
|
||||||
|
|
||||||
#if !NETSTANDARD1_3
|
#if NET46
|
||||||
RuntimeHelpers.PrepareConstrainedRegions();
|
RuntimeHelpers.PrepareConstrainedRegions();
|
||||||
|
#elif NETSTANDARD1_3
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -168,8 +171,11 @@ namespace Microsoft.AspNetCore.DataProtection.Cng
|
||||||
fixed (byte* pbRetVal = retVal)
|
fixed (byte* pbRetVal = retVal)
|
||||||
{
|
{
|
||||||
var handleAcquired = false;
|
var handleAcquired = false;
|
||||||
#if !NETSTANDARD1_3
|
#if NET46
|
||||||
RuntimeHelpers.PrepareConstrainedRegions();
|
RuntimeHelpers.PrepareConstrainedRegions();
|
||||||
|
#elif NETSTANDARD1_3
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -218,8 +224,11 @@ namespace Microsoft.AspNetCore.DataProtection.Cng
|
||||||
};
|
};
|
||||||
var dataOut = default(DATA_BLOB);
|
var dataOut = default(DATA_BLOB);
|
||||||
|
|
||||||
#if !NETSTANDARD1_3
|
#if NET46
|
||||||
RuntimeHelpers.PrepareConstrainedRegions();
|
RuntimeHelpers.PrepareConstrainedRegions();
|
||||||
|
#elif NETSTANDARD1_3
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -291,8 +300,11 @@ namespace Microsoft.AspNetCore.DataProtection.Cng
|
||||||
using (unencryptedPayloadHandle)
|
using (unencryptedPayloadHandle)
|
||||||
{
|
{
|
||||||
var handleAcquired = false;
|
var handleAcquired = false;
|
||||||
#if !NETSTANDARD1_3
|
#if NET46
|
||||||
RuntimeHelpers.PrepareConstrainedRegions();
|
RuntimeHelpers.PrepareConstrainedRegions();
|
||||||
|
#elif NETSTANDARD1_3
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Microsoft.Win32;
|
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;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -249,7 +249,7 @@ namespace Microsoft.AspNetCore.DataProtection
|
||||||
return builder;
|
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>
|
/// <summary>
|
||||||
/// Configures keys to be encrypted to a given certificate before being persisted to storage.
|
/// Configures keys to be encrypted to a given certificate before being persisted to storage.
|
||||||
|
|
@ -321,7 +321,9 @@ namespace Microsoft.AspNetCore.DataProtection
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
#elif NETSTANDARD1_3
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -98,8 +98,11 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||||
return dataProtectionProvider;
|
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>();
|
services.TryAddSingleton<ICertificateResolver, CertificateResolver>();
|
||||||
|
#elif NETSTANDARD1_3
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.DataProtection
|
namespace Microsoft.AspNetCore.DataProtection
|
||||||
{
|
{
|
||||||
#if !NETSTANDARD1_3
|
#if NET46
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides access to configuration for the data protection system, which allows the
|
/// Provides access to configuration for the data protection system, which allows the
|
||||||
/// developer to configure default cryptographic algorithms, key storage locations,
|
/// 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.
|
/// contain existing keys that use older algorithms or protection mechanisms.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
#else
|
#elif NETSTANDARD1_3
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides access to configuration for the data protection system, which allows the
|
/// Provides access to configuration for the data protection system, which allows the
|
||||||
/// developer to configure default cryptographic algorithms, key storage locations,
|
/// 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.
|
/// contain existing keys that use older algorithms or protection mechanisms.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
public interface IDataProtectionBuilder
|
public interface IDataProtectionBuilder
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -343,11 +343,13 @@ namespace Microsoft.AspNetCore.DataProtection.Managed
|
||||||
|
|
||||||
using (var validationAlgorithm = CreateValidationAlgorithm(validationSubkey))
|
using (var validationAlgorithm = CreateValidationAlgorithm(validationSubkey))
|
||||||
{
|
{
|
||||||
#if !NETSTANDARD1_3
|
#if NET46
|
||||||
// As an optimization, avoid duplicating the underlying buffer if we're on desktop CLR.
|
// As an optimization, avoid duplicating the underlying buffer if we're on desktop CLR.
|
||||||
var underlyingBuffer = outputStream.GetBuffer();
|
var underlyingBuffer = outputStream.GetBuffer();
|
||||||
#else
|
#elif NETSTANDARD1_3
|
||||||
var underlyingBuffer = outputStream.ToArray();
|
var underlyingBuffer = outputStream.ToArray();
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
var mac = validationAlgorithm.ComputeHash(underlyingBuffer, KEY_MODIFIER_SIZE_IN_BYTES, checked((int)outputStream.Length - KEY_MODIFIER_SIZE_IN_BYTES));
|
var mac = validationAlgorithm.ComputeHash(underlyingBuffer, KEY_MODIFIER_SIZE_IN_BYTES, checked((int)outputStream.Length - KEY_MODIFIER_SIZE_IN_BYTES));
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>ASP.NET Core logic to protect and unprotect data, similar to DPAPI.</Description>
|
<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>
|
<NoWarn>$(NoWarn);CS1591</NoWarn>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
<PackageReference Include="Microsoft.Extensions.Options" Version="$(AspNetCoreVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Options" Version="$(AspNetCoreVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' ">
|
<ItemGroup Condition=" '$(TargetFramework)' == 'net46' ">
|
||||||
<Reference Include="System.Security" />
|
<Reference Include="System.Security" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ namespace Microsoft.AspNetCore.DataProtection.Repositories
|
||||||
|
|
||||||
private static DirectoryInfo GetDefaultKeyStorageDirectory()
|
private static DirectoryInfo GetDefaultKeyStorageDirectory()
|
||||||
{
|
{
|
||||||
#if !NETSTANDARD1_3
|
#if NET46
|
||||||
// Environment.GetFolderPath returns null if the user profile isn't loaded.
|
// Environment.GetFolderPath returns null if the user profile isn't loaded.
|
||||||
var folderPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
var folderPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||||
if (!String.IsNullOrEmpty(folderPath))
|
if (!String.IsNullOrEmpty(folderPath))
|
||||||
|
|
@ -93,7 +93,7 @@ namespace Microsoft.AspNetCore.DataProtection.Repositories
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
#else
|
#elif NETSTANDARD1_3
|
||||||
// On core CLR, we need to fall back to environment variables.
|
// On core CLR, we need to fall back to environment variables.
|
||||||
DirectoryInfo retVal;
|
DirectoryInfo retVal;
|
||||||
|
|
||||||
|
|
@ -131,6 +131,8 @@ namespace Microsoft.AspNetCore.DataProtection.Repositories
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// 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;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
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
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// 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;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
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
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -38,5 +38,7 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#elif NET46
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// 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;
|
||||||
using System.Security.Cryptography.Xml;
|
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
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// 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;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
|
|
||||||
|
|
@ -20,5 +20,7 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption
|
||||||
X509Certificate2 ResolveCertificate(string thumbprint);
|
X509Certificate2 ResolveCertificate(string thumbprint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#elif NETSTANDARD1_3
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// 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;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
|
@ -17,5 +17,7 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption
|
||||||
EncryptedData PerformEncryption(EncryptedXml encryptedXml, XmlElement elementToEncrypt);
|
EncryptedData PerformEncryption(EncryptedXml encryptedXml, XmlElement elementToEncrypt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#elif NETSTANDARD1_3
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// 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;
|
||||||
using System.Security.Cryptography.Xml;
|
using System.Security.Cryptography.Xml;
|
||||||
|
|
@ -16,5 +16,7 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption
|
||||||
void PerformPreDecryptionSetup(EncryptedXml encryptedXml);
|
void PerformPreDecryptionSetup(EncryptedXml encryptedXml);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#elif NETSTANDARD1_3
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption
|
||||||
var memoryStream = new MemoryStream(DEFAULT_BUFFER_SIZE);
|
var memoryStream = new MemoryStream(DEFAULT_BUFFER_SIZE);
|
||||||
element.Save(memoryStream);
|
element.Save(memoryStream);
|
||||||
|
|
||||||
#if !NETSTANDARD1_3
|
#if NET46
|
||||||
var underlyingBuffer = memoryStream.GetBuffer();
|
var underlyingBuffer = memoryStream.GetBuffer();
|
||||||
fixed (byte* __unused__ = underlyingBuffer) // try to limit this moving around in memory while we allocate
|
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);
|
Array.Clear(underlyingBuffer, 0, underlyingBuffer.Length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#elif NETSTANDARD1_3
|
||||||
ArraySegment<byte> underlyingBuffer;
|
ArraySegment<byte> underlyingBuffer;
|
||||||
CryptoUtil.Assert(memoryStream.TryGetBuffer(out underlyingBuffer), "Underlying buffer isn't exposable.");
|
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
|
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);
|
Array.Clear(underlyingBuffer.Array, underlyingBuffer.Offset, underlyingBuffer.Count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
#error target frameworks need to be updated.
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,9 @@
|
||||||
<Import Project="..\..\build\common.props" />
|
<Import Project="..\..\build\common.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
|
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(PackageTargetFallback);dnxcore50;portable-net451+win8</PackageTargetFallback>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<Import Project="..\..\build\common.props" />
|
<Import Project="..\..\build\common.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
|
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<Import Project="..\..\build\common.props" />
|
<Import Project="..\..\build\common.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
|
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<Import Project="..\..\build\common.props" />
|
<Import Project="..\..\build\common.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
|
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(PackageTargetFallback);dnxcore50;portable-net451+win8</PackageTargetFallback>
|
<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]
|
[ConditionalFact]
|
||||||
[ConditionalRunTestOnlyIfLocalAppDataAvailable]
|
[ConditionalRunTestOnlyIfLocalAppDataAvailable]
|
||||||
[ConditionalRunTestOnlyOnWindows]
|
[ConditionalRunTestOnlyOnWindows]
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<Import Project="..\..\build\common.props" />
|
<Import Project="..\..\build\common.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
|
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<Import Project="..\..\build\common.props" />
|
<Import Project="..\..\build\common.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
|
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// 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;
|
||||||
using System.Runtime.ConstrainedExecution;
|
using System.Runtime.ConstrainedExecution;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
<Import Project="..\..\build\common.props" />
|
<Import Project="..\..\build\common.props" />
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netcoreapp2.0;net452</TargetFrameworks>
|
<TargetFrameworks>netcoreapp2.0;net46</TargetFrameworks>
|
||||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
<PackageReference Include="xunit" Version="$(XunitVersion)" />
|
<PackageReference Include="xunit" Version="$(XunitVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(TargetFramework)'=='net452'">
|
<ItemGroup Condition="'$(TargetFramework)'=='net46'">
|
||||||
<Reference Include="System.Security" />
|
<Reference Include="System.Security" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ namespace Microsoft.AspNetCore.DataProtection.Repositories
|
||||||
{
|
{
|
||||||
#if NETCOREAPP2_0
|
#if NETCOREAPP2_0
|
||||||
return Environment.GetEnvironmentVariable("LOCALAPPDATA");
|
return Environment.GetEnvironmentVariable("LOCALAPPDATA");
|
||||||
#elif NET452
|
#elif NET46
|
||||||
return Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
return Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||||
#else
|
#else
|
||||||
#error Target framework needs to be updated
|
#error Target framework needs to be updated
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
// 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.
|
// 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;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Security.Cryptography.Xml;
|
using System.Security.Cryptography.Xml;
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ namespace Microsoft.AspNetCore.DataProtection.XmlEncryption
|
||||||
XmlAssert.Equal(originalXml, roundTrippedElement);
|
XmlAssert.Equal(originalXml, roundTrippedElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if NET452
|
#if NET46
|
||||||
[ConditionalFact]
|
[ConditionalFact]
|
||||||
[ConditionalRunTestOnlyOnWindows]
|
[ConditionalRunTestOnlyOnWindows]
|
||||||
public void Encrypt_CurrentUser_Decrypt_ImpersonatedAsAnonymous_Fails()
|
public void Encrypt_CurrentUser_Decrypt_ImpersonatedAsAnonymous_Fails()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue