Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@@ -0,0 +1,136 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Net.Security.Tests", "tests\FunctionalTests\System.Net.Security.Tests.csproj", "{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}"
ProjectSection(ProjectDependencies) = postProject
{} = {}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Net.Security.Unit.Tests", "tests\UnitTests\System.Net.Security.Unit.Tests.csproj", "{0D174EA9-9E61-4519-8D31-7BD2331A1982}"
ProjectSection(ProjectDependencies) = postProject
{} = {}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Net.Security.Unit.Tests", "tests\UnitTests\System.Net.Security.Unit.Tests.csproj", "{0D174EA9-9E61-4519-8D31-7BD2331A1982}"
ProjectSection(ProjectDependencies) = postProject
{89F37791-6254-4D60-AB96-ACD3CCA0E771} = {89F37791-6254-4D60-AB96-ACD3CCA0E771}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Net.Security.Tests", "tests\FunctionalTests\System.Net.Security.Tests.csproj", "{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}"
ProjectSection(ProjectDependencies) = postProject
{89F37791-6254-4D60-AB96-ACD3CCA0E771} = {89F37791-6254-4D60-AB96-ACD3CCA0E771}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{1B8F56A7-863B-4E11-A882-D83EEA79C997}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{67450222-8C09-4F6E-AB24-63DFBE696A84}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{146555EC-BB30-4833-B1B3-C4F727E9DF77}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Net.Security", "ref\System.Net.Security.csproj", "{0F78E13E-74EE-40F0-8E0B-A026C7794CCB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Net.Security", "src\System.Net.Security.csproj", "{89F37791-6254-4D60-AB96-ACD3CCA0E771}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FunctionalTests", "FunctionalTests", "{7665987C-3533-4785-9EBC-C1B76A433CD6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UnitTests", "UnitTests", "{2C9E787E-150A-4C0F-979B-0E28FAC45BAA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU = DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU
ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU = ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU
DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU = DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU
ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU = ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU
DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU = DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU
ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU = ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU
DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU = DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU
ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU = ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU
DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU = DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU
ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU = ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU
DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU = DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU
ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU = ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = net463-Windows_NT-Debug|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = net463-Windows_NT-Debug|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = net463-Windows_NT-Release|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = net463-Windows_NT-Release|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = net463-Windows_NT-Debug|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = net463-Windows_NT-Debug|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = net463-Windows_NT-Release|Any CPU
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = net463-Windows_NT-Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2} = {A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}
{89F37791-6254-4D60-AB96-ACD3CCA0E771} = {89F37791-6254-4D60-AB96-ACD3CCA0E771}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />
<PropertyGroup>
<AssemblyVersion>4.1.0.0</AssemblyVersion>
<IsNETCoreApp>true</IsNETCoreApp>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netcoreapp;
uap;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<Project Include="System.Net.Security.csproj" />
<Project Include="System.Net.Security.csproj">
<TargetGroup>netcoreapp</TargetGroup>
</Project>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
</Project>

View File

@@ -0,0 +1,215 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// ------------------------------------------------------------------------------
// Changes to this file must follow the http://aka.ms/api-review process.
// ------------------------------------------------------------------------------
namespace System.Net.Security
{
public abstract class AuthenticatedStream : System.IO.Stream
{
protected AuthenticatedStream(System.IO.Stream innerStream, bool leaveInnerStreamOpen) { }
public abstract bool IsAuthenticated { get; }
public abstract bool IsEncrypted { get; }
public abstract bool IsMutuallyAuthenticated { get; }
public abstract bool IsServer { get; }
public abstract bool IsSigned { get; }
public bool LeaveInnerStreamOpen { get { throw null; } }
protected System.IO.Stream InnerStream { get { throw null; } }
protected override void Dispose(bool disposing) { }
}
public enum EncryptionPolicy
{
AllowNoEncryption = 1,
NoEncryption = 2,
RequireEncryption = 0,
}
public delegate System.Security.Cryptography.X509Certificates.X509Certificate LocalCertificateSelectionCallback(object sender, string targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection localCertificates, System.Security.Cryptography.X509Certificates.X509Certificate remoteCertificate, string[] acceptableIssuers);
public partial class NegotiateStream : AuthenticatedStream
{
public NegotiateStream(System.IO.Stream innerStream) : base(innerStream, false) { }
public NegotiateStream(System.IO.Stream innerStream, bool leaveInnerStreamOpen) : base(innerStream, leaveInnerStreamOpen) { }
public override bool CanRead { get { throw null; } }
public override bool CanSeek { get { throw null; } }
public override bool CanTimeout { get { throw null; } }
public override bool CanWrite { get { throw null; } }
public virtual System.Security.Principal.TokenImpersonationLevel ImpersonationLevel { get { throw null; } }
public override bool IsAuthenticated { get { throw null; } }
public override bool IsEncrypted { get { throw null; } }
public override bool IsMutuallyAuthenticated { get { throw null; } }
public override bool IsServer { get { throw null; } }
public override bool IsSigned { get { throw null; } }
public override long Length { get { throw null; } }
public override long Position { get { throw null; } set { } }
public override int ReadTimeout { get { throw null; } set { } }
public virtual System.Security.Principal.IIdentity RemoteIdentity { get { throw null; } }
public override int WriteTimeout { get { throw null; } set { } }
public virtual void AuthenticateAsClient() { }
public virtual void AuthenticateAsClient(System.Net.NetworkCredential credential, string targetName) { }
public virtual void AuthenticateAsClient(System.Net.NetworkCredential credential, System.Security.Authentication.ExtendedProtection.ChannelBinding binding, string targetName) { }
public virtual void AuthenticateAsClient(System.Net.NetworkCredential credential, string targetName, System.Net.Security.ProtectionLevel requiredProtectionLevel, System.Security.Principal.TokenImpersonationLevel allowedImpersonationLevel) { }
public virtual void AuthenticateAsClient(System.Net.NetworkCredential credential, System.Security.Authentication.ExtendedProtection.ChannelBinding binding, string targetName, System.Net.Security.ProtectionLevel requiredProtectionLevel, System.Security.Principal.TokenImpersonationLevel allowedImpersonationLevel) { }
public virtual void AuthenticateAsServer() { }
public virtual void AuthenticateAsServer(System.Security.Authentication.ExtendedProtection.ExtendedProtectionPolicy policy) { }
public virtual void AuthenticateAsServer(NetworkCredential credential, ProtectionLevel requiredProtectionLevel, System.Security.Principal.TokenImpersonationLevel requiredImpersonationLevel) { }
public virtual void AuthenticateAsServer(NetworkCredential credential, System.Security.Authentication.ExtendedProtection.ExtendedProtectionPolicy policy, ProtectionLevel requiredProtectionLevel, System.Security.Principal.TokenImpersonationLevel requiredImpersonationLevel) { }
public virtual System.Threading.Tasks.Task AuthenticateAsClientAsync() { throw null; }
public virtual System.Threading.Tasks.Task AuthenticateAsClientAsync(NetworkCredential credential, string targetName) { throw null; }
public virtual System.Threading.Tasks.Task AuthenticateAsClientAsync(NetworkCredential credential, System.Security.Authentication.ExtendedProtection.ChannelBinding binding, string targetName) { throw null; }
public virtual System.Threading.Tasks.Task AuthenticateAsClientAsync(NetworkCredential credential, string targetName, ProtectionLevel requiredProtectionLevel, System.Security.Principal.TokenImpersonationLevel allowedImpersonationLevel) { throw null; }
public virtual System.Threading.Tasks.Task AuthenticateAsClientAsync(NetworkCredential credential, System.Security.Authentication.ExtendedProtection.ChannelBinding binding, string targetName, ProtectionLevel requiredProtectionLevel, System.Security.Principal.TokenImpersonationLevel allowedImpersonationLevel) { throw null; }
public virtual System.Threading.Tasks.Task AuthenticateAsServerAsync() { throw null; }
public virtual System.Threading.Tasks.Task AuthenticateAsServerAsync(System.Security.Authentication.ExtendedProtection.ExtendedProtectionPolicy policy) { throw null; }
public virtual System.Threading.Tasks.Task AuthenticateAsServerAsync(NetworkCredential credential, ProtectionLevel requiredProtectionLevel, System.Security.Principal.TokenImpersonationLevel requiredImpersonationLevel) { throw null; }
public virtual System.Threading.Tasks.Task AuthenticateAsServerAsync(NetworkCredential credential, System.Security.Authentication.ExtendedProtection.ExtendedProtectionPolicy policy, ProtectionLevel requiredProtectionLevel, System.Security.Principal.TokenImpersonationLevel requiredImpersonationLevel) { throw null; }
public virtual System.IAsyncResult BeginAuthenticateAsClient(System.AsyncCallback asyncCallback, object asyncState) { throw null; }
public virtual System.IAsyncResult BeginAuthenticateAsClient(System.Net.NetworkCredential credential, string targetName, System.AsyncCallback asyncCallback, object asyncState) { throw null; }
public virtual System.IAsyncResult BeginAuthenticateAsClient(System.Net.NetworkCredential credential, System.Security.Authentication.ExtendedProtection.ChannelBinding binding, string targetName, System.AsyncCallback asyncCallback, object asyncState) { throw null; }
public virtual System.IAsyncResult BeginAuthenticateAsClient(System.Net.NetworkCredential credential, string targetName, System.Net.Security.ProtectionLevel requiredProtectionLevel, System.Security.Principal.TokenImpersonationLevel allowedImpersonationLevel, System.AsyncCallback asyncCallback, object asyncState) { throw null; }
public virtual System.IAsyncResult BeginAuthenticateAsClient(System.Net.NetworkCredential credential, System.Security.Authentication.ExtendedProtection.ChannelBinding binding, string targetName, System.Net.Security.ProtectionLevel requiredProtectionLevel, System.Security.Principal.TokenImpersonationLevel allowedImpersonationLevel, System.AsyncCallback asyncCallback, object asyncState) { throw null; }
public virtual System.IAsyncResult BeginAuthenticateAsServer(AsyncCallback asyncCallback, object asyncState) { throw null; }
public virtual System.IAsyncResult BeginAuthenticateAsServer(System.Security.Authentication.ExtendedProtection.ExtendedProtectionPolicy policy, System.AsyncCallback asyncCallback, object asyncState) { throw null; }
public virtual IAsyncResult BeginAuthenticateAsServer(System.Net.NetworkCredential credential, System.Net.Security.ProtectionLevel requiredProtectionLevel, System.Security.Principal.TokenImpersonationLevel requiredImpersonationLevel, System.AsyncCallback asyncCallback, object asyncState) { throw null; }
public virtual IAsyncResult BeginAuthenticateAsServer(System.Net.NetworkCredential credential, System.Security.Authentication.ExtendedProtection.ExtendedProtectionPolicy policy, System.Net.Security.ProtectionLevel requiredProtectionLevel, System.Security.Principal.TokenImpersonationLevel requiredImpersonationLevel, System.AsyncCallback asyncCallback, object asyncState) { throw null; }
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState) { throw null; }
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState) { throw null; }
protected override void Dispose(bool disposing) { }
public virtual void EndAuthenticateAsClient(System.IAsyncResult asyncResult) { }
public virtual void EndAuthenticateAsServer(System.IAsyncResult asyncResult) { }
public override int EndRead(IAsyncResult asyncResult) { throw null; }
public override void EndWrite(IAsyncResult asyncResult) { }
public override void Flush() { }
public override System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public override int Read(byte[] buffer, int offset, int count) { throw null; }
public override long Seek(long offset, System.IO.SeekOrigin origin) { throw null; }
public override void SetLength(long value) { }
public override void Write(byte[] buffer, int offset, int count) { }
}
public enum ProtectionLevel
{
None = 0,
Sign = 1,
EncryptAndSign = 2
}
public delegate bool RemoteCertificateValidationCallback(object sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors);
public partial class SslStream : AuthenticatedStream
{
public SslStream(System.IO.Stream innerStream) : base(innerStream, false) { }
public SslStream(System.IO.Stream innerStream, bool leaveInnerStreamOpen) : base(innerStream, leaveInnerStreamOpen) { }
public SslStream(System.IO.Stream innerStream, bool leaveInnerStreamOpen, System.Net.Security.RemoteCertificateValidationCallback userCertificateValidationCallback) : base(innerStream, leaveInnerStreamOpen) { }
public SslStream(System.IO.Stream innerStream, bool leaveInnerStreamOpen, System.Net.Security.RemoteCertificateValidationCallback userCertificateValidationCallback, System.Net.Security.LocalCertificateSelectionCallback userCertificateSelectionCallback) : base(innerStream, leaveInnerStreamOpen) { }
public SslStream(System.IO.Stream innerStream, bool leaveInnerStreamOpen, System.Net.Security.RemoteCertificateValidationCallback userCertificateValidationCallback, System.Net.Security.LocalCertificateSelectionCallback userCertificateSelectionCallback, System.Net.Security.EncryptionPolicy encryptionPolicy) : base(innerStream, leaveInnerStreamOpen) { }
public override bool CanRead { get { throw null; } }
public override bool CanSeek { get { throw null; } }
public override bool CanTimeout { get { throw null; } }
public override bool CanWrite { get { throw null; } }
public virtual bool CheckCertRevocationStatus { get { throw null; } }
public virtual System.Security.Authentication.CipherAlgorithmType CipherAlgorithm { get { throw null; } }
public virtual int CipherStrength { get { throw null; } }
public virtual System.Security.Authentication.HashAlgorithmType HashAlgorithm { get { throw null; } }
public virtual int HashStrength { get { throw null; } }
public override bool IsAuthenticated { get { throw null; } }
public override bool IsEncrypted { get { throw null; } }
public override bool IsMutuallyAuthenticated { get { throw null; } }
public override bool IsServer { get { throw null; } }
public override bool IsSigned { get { throw null; } }
public virtual System.Security.Authentication.ExchangeAlgorithmType KeyExchangeAlgorithm { get { throw null; } }
public virtual int KeyExchangeStrength { get { throw null; } }
public override long Length { get { throw null; } }
public virtual System.Security.Cryptography.X509Certificates.X509Certificate LocalCertificate { get { throw null; } }
public override long Position { get { throw null; } set { } }
public override int ReadTimeout { get { throw null; } set { } }
public virtual System.Security.Cryptography.X509Certificates.X509Certificate RemoteCertificate { get { throw null; } }
public virtual System.Security.Authentication.SslProtocols SslProtocol { get { throw null; } }
public System.Net.TransportContext TransportContext { get { throw null; } }
public override int WriteTimeout { get { throw null; } set { } }
public virtual void AuthenticateAsClient(string targetHost) { }
public virtual void AuthenticateAsClient(string targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, bool checkCertificateRevocation) { }
public virtual void AuthenticateAsClient(string targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, bool checkCertificateRevocation) { }
public virtual void AuthenticateAsServer(System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate) { }
public virtual void AuthenticateAsServer(System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, System.Security.Authentication.SslProtocols enabledSslProtocols, bool checkCertificateRevocation) { }
public virtual void AuthenticateAsServer(System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation) { }
public virtual System.Threading.Tasks.Task AuthenticateAsClientAsync(string targetHost) { throw null; }
public virtual System.Threading.Tasks.Task AuthenticateAsClientAsync(string targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, bool checkCertificateRevocation) { throw null; }
public virtual System.Threading.Tasks.Task AuthenticateAsClientAsync(string targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, bool checkCertificateRevocation) { throw null; }
public virtual System.Threading.Tasks.Task AuthenticateAsServerAsync(System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate) { throw null; }
public virtual System.Threading.Tasks.Task AuthenticateAsServerAsync(System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, System.Security.Authentication.SslProtocols enabledSslProtocols, bool checkCertificateRevocation) { throw null; }
public virtual System.Threading.Tasks.Task AuthenticateAsServerAsync(System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation) { throw null; }
public virtual System.IAsyncResult BeginAuthenticateAsClient(string targetHost, System.AsyncCallback asyncCallback, object asyncState) { throw null; }
public virtual System.IAsyncResult BeginAuthenticateAsClient(string targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, System.Security.Authentication.SslProtocols enabledSslProtocols, bool checkCertificateRevocation, System.AsyncCallback asyncCallback, object asyncState) { throw null; }
public virtual System.IAsyncResult BeginAuthenticateAsClient(string targetHost, System.Security.Cryptography.X509Certificates.X509CertificateCollection clientCertificates, bool checkCertificateRevocation, System.AsyncCallback asyncCallback, object asyncState) { throw null; }
public virtual System.IAsyncResult BeginAuthenticateAsServer(System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, System.AsyncCallback asyncCallback, object asyncState) { throw null; }
public virtual System.IAsyncResult BeginAuthenticateAsServer(System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, System.Security.Authentication.SslProtocols enabledSslProtocols, bool checkCertificateRevocation, System.AsyncCallback asyncCallback, object asyncState) { throw null; }
public virtual System.IAsyncResult BeginAuthenticateAsServer(System.Security.Cryptography.X509Certificates.X509Certificate serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation, System.AsyncCallback asyncCallback, object asyncState) { throw null; }
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState) { throw null; }
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState) { throw null; }
protected override void Dispose(bool disposing) { }
public virtual void EndAuthenticateAsClient(IAsyncResult asyncResult) { }
public virtual void EndAuthenticateAsServer(IAsyncResult asyncResult) { }
public override int EndRead(IAsyncResult asyncResult) { throw null; }
public override void EndWrite(IAsyncResult asyncResult) { }
public override void Flush() { }
public override System.Threading.Tasks.Task FlushAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
public override int Read(byte[] buffer, int offset, int count) { throw null; }
public override long Seek(long offset, System.IO.SeekOrigin origin) { throw null; }
public override void SetLength(long value) { }
public virtual System.Threading.Tasks.Task ShutdownAsync() { throw null; }
public void Write(byte[] buffer) { }
public override void Write(byte[] buffer, int offset, int count) { }
}
}
namespace System.Security.Authentication
{
public partial class AuthenticationException : System.SystemException
{
public AuthenticationException() { }
public AuthenticationException(string message) { }
public AuthenticationException(string message, System.Exception innerException) { }
protected AuthenticationException(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { }
}
public partial class InvalidCredentialException : System.Security.Authentication.AuthenticationException
{
public InvalidCredentialException() { }
public InvalidCredentialException(string message) { }
public InvalidCredentialException(string message, System.Exception innerException) { }
protected InvalidCredentialException(System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext) { }
}
}
namespace System.Security.Authentication.ExtendedProtection
{
public partial class ExtendedProtectionPolicy : System.Runtime.Serialization.ISerializable
{
public ExtendedProtectionPolicy(System.Security.Authentication.ExtendedProtection.PolicyEnforcement policyEnforcement) { }
public ExtendedProtectionPolicy(System.Security.Authentication.ExtendedProtection.PolicyEnforcement policyEnforcement, System.Security.Authentication.ExtendedProtection.ChannelBinding customChannelBinding) { }
public ExtendedProtectionPolicy(System.Security.Authentication.ExtendedProtection.PolicyEnforcement policyEnforcement, System.Security.Authentication.ExtendedProtection.ProtectionScenario protectionScenario, System.Collections.ICollection customServiceNames) { }
public ExtendedProtectionPolicy(System.Security.Authentication.ExtendedProtection.PolicyEnforcement policyEnforcement, System.Security.Authentication.ExtendedProtection.ProtectionScenario protectionScenario, System.Security.Authentication.ExtendedProtection.ServiceNameCollection customServiceNames) { }
protected ExtendedProtectionPolicy(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public System.Security.Authentication.ExtendedProtection.ChannelBinding CustomChannelBinding { get { throw null; } }
public System.Security.Authentication.ExtendedProtection.ServiceNameCollection CustomServiceNames { get { throw null; } }
public static bool OSSupportsExtendedProtection { get { throw null; } }
public System.Security.Authentication.ExtendedProtection.PolicyEnforcement PolicyEnforcement { get { throw null; } }
public System.Security.Authentication.ExtendedProtection.ProtectionScenario ProtectionScenario { get { throw null; } }
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public override string ToString() { throw null; }
}
public enum PolicyEnforcement
{
Always = 2,
Never = 0,
WhenSupported = 1,
}
public enum ProtectionScenario
{
TransportSelected = 0,
TrustedProxy = 1,
}
public partial class ServiceNameCollection : System.Collections.ReadOnlyCollectionBase
{
public ServiceNameCollection(System.Collections.ICollection items) { }
public bool Contains(string searchServiceName) { throw null; }
public System.Security.Authentication.ExtendedProtection.ServiceNameCollection Merge(System.Collections.IEnumerable serviceNames) { throw null; }
public System.Security.Authentication.ExtendedProtection.ServiceNameCollection Merge(string serviceName) { throw null; }
}
}

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Release|AnyCPU'" />
<ItemGroup>
<Compile Include="System.Net.Security.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\System.Collections.NonGeneric\ref\System.Collections.NonGeneric.csproj" />
<ProjectReference Include="..\..\System.IO\ref\System.IO.csproj" />
<ProjectReference Include="..\..\System.Net.Primitives\ref\System.Net.Primitives.csproj" />
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
<ProjectReference Include="..\..\System.Runtime.Handles\ref\System.Runtime.Handles.csproj" />
<ProjectReference Include="..\..\System.Security.Cryptography.X509Certificates\ref\System.Security.Cryptography.X509Certificates.csproj" />
<ProjectReference Include="..\..\System.Security.Principal\ref\System.Security.Principal.csproj" />
<ProjectReference Include="..\..\System.Threading.Tasks\ref\System.Threading.Tasks.csproj" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netcoreapp-Unix;
netcoreapp-Windows_NT;
net463-Windows_NT;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,450 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Arg_RankMultiDimNotSupported" xml:space="preserve">
<value>Only single dimensional arrays are supported for the requested action.</value>
</data>
<data name="ArgumentOutOfRange_NeedNonNegNum" xml:space="preserve">
<value>Index is less than zero.</value>
</data>
<data name="Arg_ArrayPlusOffTooSmall" xml:space="preserve">
<value>Destination array is not long enough to copy all the items in the collection. Check array index and length.</value>
</data>
<data name="net_noseek" xml:space="preserve">
<value>This stream does not support seek operations.</value>
</data>
<data name="net_mustbeuri" xml:space="preserve">
<value>The {0} parameter must represent a valid Uri (see inner exception).</value>
</data>
<data name="net_securitypackagesupport" xml:space="preserve">
<value>The requested security package is not supported.</value>
</data>
<data name="net_securityprotocolnotsupported" xml:space="preserve">
<value>The requested security protocol is not supported.</value>
</data>
<data name="net_MethodNotImplementedException" xml:space="preserve">
<value>This method is not implemented by this class.</value>
</data>
<data name="net_completed_result" xml:space="preserve">
<value>This operation cannot be performed on a completed asynchronous result object.</value>
</data>
<data name="net_io_readfailure" xml:space="preserve">
<value>Unable to read data from the transport connection: {0}.</value>
</data>
<data name="net_io_connectionclosed" xml:space="preserve">
<value>The connection was closed</value>
</data>
<data name="net_io_invalidnestedcall" xml:space="preserve">
<value> The {0} method cannot be called when another {1} operation is pending.</value>
</data>
<data name="net_io_invalidendcall" xml:space="preserve">
<value>{0} can only be called once for each asynchronous operation.</value>
</data>
<data name="net_io_must_be_rw_stream" xml:space="preserve">
<value>The stream has to be read/write.</value>
</data>
<data name="net_io_header_id" xml:space="preserve">
<value>Found a wrong header field {0} read : {1}, expected : {2}.</value>
</data>
<data name="net_io_out_range" xml:space="preserve">
<value>The byte count must not exceed {0} bytes for this stream type.</value>
</data>
<data name="net_io_encrypt" xml:space="preserve">
<value>The encryption operation failed, see inner exception.</value>
</data>
<data name="net_io_decrypt" xml:space="preserve">
<value>The decryption operation failed, see inner exception.</value>
</data>
<data name="net_io_read" xml:space="preserve">
<value>The read operation failed, see inner exception.</value>
</data>
<data name="net_io_write" xml:space="preserve">
<value>The write operation failed, see inner exception.</value>
</data>
<data name="net_io_eof" xml:space="preserve">
<value> Received an unexpected EOF or 0 bytes from the transport stream.</value>
</data>
<data name="net_io_async_result" xml:space="preserve">
<value>The parameter: {0} is not valid. Use the object returned from corresponding Begin async call.</value>
</data>
<data name="net_ssl_io_frame" xml:space="preserve">
<value>The handshake failed due to an unexpected packet format.</value>
</data>
<data name="net_ssl_io_cert_validation" xml:space="preserve">
<value>The remote certificate is invalid according to the validation procedure.</value>
</data>
<data name="net_ssl_io_no_server_cert" xml:space="preserve">
<value>The server mode SSL must use a certificate with the associated private key.</value>
</data>
<data name="net_ssl_io_already_shutdown" xml:space="preserve">
<value>Write operations are not allowed after the channel was shutdown.</value>
</data>
<data name="net_auth_bad_client_creds" xml:space="preserve">
<value>The server has rejected the client credentials.</value>
</data>
<data name="net_auth_bad_client_creds_or_target_mismatch" xml:space="preserve">
<value>Either the target name is incorrect or the server has rejected the client credentials.</value>
</data>
<data name="net_auth_context_expectation" xml:space="preserve">
<value>A security requirement was not fulfilled during authentication. Required: {0}, negotiated: {1}.</value>
</data>
<data name="net_auth_context_expectation_remote" xml:space="preserve">
<value>A remote side security requirement was not fulfilled during authentication. Try increasing the ProtectionLevel and/or ImpersonationLevel.</value>
</data>
<data name="net_auth_supported_impl_levels" xml:space="preserve">
<value>The supported values are Identification, Impersonation or Delegation.</value>
</data>
<data name="net_auth_reauth" xml:space="preserve">
<value>This operation is not allowed on a security context that has already been authenticated.</value>
</data>
<data name="net_auth_noauth" xml:space="preserve">
<value>This operation is only allowed using a successfully authenticated context.</value>
</data>
<data name="net_auth_client_server" xml:space="preserve">
<value>Once authentication is attempted as the client or server, additional authentication attempts must use the same client or server role.</value>
</data>
<data name="net_auth_SSPI" xml:space="preserve">
<value>A call to SSPI failed, see inner exception.</value>
</data>
<data name="net_auth_eof" xml:space="preserve">
<value>Authentication failed because the remote party has closed the transport stream.</value>
</data>
<data name="net_auth_alert" xml:space="preserve">
<value>Authentication failed on the remote side (the stream might still be available for additional authentication attempts).</value>
</data>
<data name="net_auth_ignored_reauth" xml:space="preserve">
<value>Re-authentication failed because the remote party continued to encrypt more than {0} bytes before answering re-authentication.</value>
</data>
<data name="net_auth_message_not_encrypted" xml:space="preserve">
<value>Protocol error: A received message contains a valid signature but it was not encrypted as required by the effective Protection Level.</value>
</data>
<data name="net_auth_must_specify_extended_protection_scheme" xml:space="preserve">
<value>An extended protection policy must specify either a custom channel binding or a custom service name collection.</value>
</data>
<data name="net_frame_size" xml:space="preserve">
<value>Received an invalid authentication frame. The message size is limited to {0} bytes, attempted to read {1} bytes.</value>
</data>
<data name="net_frame_read_io" xml:space="preserve">
<value>Received incomplete authentication message. Remote party has probably closed the connection.</value>
</data>
<data name="net_frame_read_size" xml:space="preserve">
<value>Cannot determine the frame size or a corrupted frame was received.</value>
</data>
<data name="net_frame_max_size" xml:space="preserve">
<value>The payload size is limited to {0}, attempted set it to {1}.</value>
</data>
<data name="net_offset_plus_count" xml:space="preserve">
<value>Sum of offset and count cannot be greater than the length of the buffer.</value>
</data>
<data name="net_invalid_enum" xml:space="preserve">
<value>The specified value is not valid in the '{0}' enumeration.</value>
</data>
<data name="net_log_exception" xml:space="preserve">
<value>Exception in {0}::{1} - {2}.</value>
</data>
<data name="event_EnumerateSecurityPackages" xml:space="preserve">
<value>Enumerating security packages:</value>
</data>
<data name="event_SspiPackageNotFound" xml:space="preserve">
<value>Security package '{0}' was not found.</value>
</data>
<data name="event_SecurityContextInputBuffer" xml:space="preserve">
<value>{0}(In-Buffer length={1}, Out-Buffer length={2}, returned code={3}).</value>
</data>
<data name="event_SecurityContextInputBuffers" xml:space="preserve">
<value>{0}(In-Buffers count={1}, Out-Buffer length={2}, returned code={3}).</value>
</data>
<data name="event_SspiSelectedCipherSuite" xml:space="preserve">
<value>{0}(Protocol={1}, Cipher={2} {3} bit strength, Hash={4} {5} bit strength, Key Exchange={6} {7} bit strength).</value>
</data>
<data name="event_RemoteCertificate" xml:space="preserve">
<value>Remote certificate: {0}.</value>
</data>
<data name="event_LocatingPrivateKey" xml:space="preserve">
<value>Locating the private key for the certificate: {0}.</value>
</data>
<data name="event_CertIsType2" xml:space="preserve">
<value>Certificate is of type X509Certificate2 and contains the private key.</value>
</data>
<data name="event_FoundCertInStore" xml:space="preserve">
<value>Found the certificate in the {0} store.</value>
</data>
<data name="event_NotFoundCertInStore" xml:space="preserve">
<value>Cannot find the certificate in either the LocalMachine store or the CurrentUser store.</value>
</data>
<data name="net_log_open_store_failed" xml:space="preserve">
<value>Opening Certificate store {0} failed, exception: {1}.</value>
</data>
<data name="event_CertificateFromDelegate" xml:space="preserve">
<value>Got a certificate from the client delegate.</value>
</data>
<data name="event_NoDelegateNoClientCert" xml:space="preserve">
<value>Client delegate did not provide a certificate; and there are not other user-provided certificates. Need to attempt a session restart.</value>
</data>
<data name="event_NoDelegateButClientCert" xml:space="preserve">
<value>Client delegate did not provide a certificate; but there are other user-provided certificates.</value>
</data>
<data name="event_AttemptingRestartUsingCert" xml:space="preserve">
<value>Attempting to restart the session using the user-provided certificate: {0}.</value>
</data>
<data name="event_NoIssuersTryAllCerts" xml:space="preserve">
<value>We have user-provided certificates. The server has not specified any issuers, so try all the certificates.</value>
</data>
<data name="event_LookForMatchingCerts" xml:space="preserve">
<value>We have user-provided certificates. The server has specified {0} issuer(s). Looking for certificates that match any of the issuers.</value>
</data>
<data name="event_SelectedCert" xml:space="preserve">
<value>Selected certificate: {0}.</value>
</data>
<data name="event_CertsAfterFiltering" xml:space="preserve">
<value>Left with {0} client certificates to choose from.</value>
</data>
<data name="event_FindingMatchingCerts" xml:space="preserve">
<value>Trying to find a matching certificate in the certificate store.</value>
</data>
<data name="event_UsingCachedCredential" xml:space="preserve">
<value>Using the cached credential handle.</value>
</data>
<data name="event_RemoteCertDeclaredValid" xml:space="preserve">
<value>Remote certificate was verified as valid by the user.</value>
</data>
<data name="event_RemoteCertUserDeclaredInvalid" xml:space="preserve">
<value>Remote certificate was verified as invalid by the user.</value>
</data>
<data name="event_RemoteCertHasNoErrors" xml:space="preserve">
<value>Remote certificate has no errors.</value>
</data>
<data name="net_log_remote_cert_has_errors" xml:space="preserve">
<value>Remote certificate has errors:</value>
</data>
<data name="net_log_remote_cert_not_available" xml:space="preserve">
<value>The remote server did not provide a certificate.</value>
</data>
<data name="net_log_remote_cert_name_mismatch" xml:space="preserve">
<value>Certificate name mismatch.</value>
</data>
<data name="event_OperationReturnedSomething" xml:space="preserve">
<value>{0} returned {1}.</value>
</data>
<data name="net_log_operation_failed_with_error" xml:space="preserve">
<value>{0} failed with error {1}.</value>
</data>
<data name="SSPIInvalidHandleType" xml:space="preserve">
<value>'{0}' is not a supported handle type.</value>
</data>
<data name="security_ExtendedProtectionPolicy_UseDifferentConstructorForNever" xml:space="preserve">
<value>To construct a policy with PolicyEnforcement.Never, the single-parameter constructor must be used.</value>
</data>
<data name="security_ExtendedProtectionPolicy_NoEmptyServiceNameCollection" xml:space="preserve">
<value>The ServiceNameCollection must contain at least one service name.</value>
</data>
<data name="security_ServiceNameCollection_EmptyServiceName" xml:space="preserve">
<value>A service name must not be null or empty.</value>
</data>
<data name="ObjectDisposed_StreamIsClosed" xml:space="preserve">
<value>Cannot access a closed Stream.</value>
</data>
<data name="NotSupported_UnreadableStream" xml:space="preserve">
<value>Stream does not support reading.</value>
</data>
<data name="NotSupported_UnwritableStream" xml:space="preserve">
<value>Stream does not support writing.</value>
</data>
<data name="net_allocate_ssl_context_failed" xml:space="preserve">
<value>Failed to allocate SSL/TLS context, OpenSSL error - {0}.</value>
</data>
<data name="net_generic_operation_failed" xml:space="preserve">
<value>Operation failed with error - {0}.</value>
</data>
<data name="net_ssl_decrypt_failed" xml:space="preserve">
<value>Decrypt failed with OpenSSL error - {0}.</value>
</data>
<data name="net_ssl_encrypt_failed" xml:space="preserve">
<value>Encrypt failed with OpenSSL error - {0}.</value>
</data>
<data name="net_get_ssl_method_failed" xml:space="preserve">
<value>Failed to get SSL method '{0}'. Ensure the OpenSSL method exists on the current system.</value>
</data>
<data name="net_ssl_check_private_key_failed" xml:space="preserve">
<value>SSL certificate private key check failed with OpenSSL error - {0}.</value>
</data>
<data name="net_ssl_handshake_failed_error" xml:space="preserve">
<value>SSL Handshake failed with OpenSSL error - {0}.</value>
</data>
<data name="net_ssl_read_bio_failed_error" xml:space="preserve">
<value>SSL Read BIO failed with OpenSSL error - {0}.</value>
</data>
<data name="net_ssl_use_cert_failed" xml:space="preserve">
<value>Using SSL certificate failed with OpenSSL error - {0}.</value>
</data>
<data name="net_ssl_use_private_key_failed" xml:space="preserve">
<value>Using SSL certificate private key failed with OpenSSL error - {0}.</value>
</data>
<data name="net_ssl_write_bio_failed_error" xml:space="preserve">
<value>SSL Write BIO failed with OpenSSL error - {0}.</value>
</data>
<data name="net_ssl_x509Name_push_failed_error" xml:space="preserve">
<value>Failed to push X509_NAME into stack.</value>
</data>
<data name="net_ssl_get_connection_info_failed" xml:space="preserve">
<value>Getting SSL connection info failed with OpenSSL error - {0}.</value>
</data>
<data name="net_ssl_get_channel_binding_token_failed" xml:space="preserve">
<value>Fetching channel binding token failed with OpenSSL error - {0}.</value>
</data>
<data name="net_ssl_invalid_certificate" xml:space="preserve">
<value>SSL certificate returned is invalid, OpenSSL error - {0}.</value>
</data>
<data name="net_ssl_encryptionpolicy_notsupported" xml:space="preserve">
<value>The '{0}' encryption policy is not supported by this installation of OpenSSL.</value>
</data>
<data name="net_gssapi_operation_failed_detailed" xml:space="preserve">
<value>GSSAPI operation failed with error - {0} ({1}).</value>
</data>
<data name="net_gssapi_operation_failed" xml:space="preserve">
<value>GSSAPI operation failed with status: {0} (Minor status: {1}).</value>
</data>
<data name="net_context_establishment_failed" xml:space="preserve">
<value>GSSAPI security context establishment failed with status: {0} (Minor status: {1}).</value>
</data>
<data name="net_context_wrap_failed" xml:space="preserve">
<value>GSSAPI encryption or signing failed with status: {0} (Minor status: {1}).</value>
</data>
<data name="net_context_unwrap_failed" xml:space="preserve">
<value>GSSAPI decryption or signature verification failed with status: {0} (Minor status: {1}).</value>
</data>
<data name="net_context_buffer_too_small" xml:space="preserve">
<value>Insufficient buffer space. Required: {0} Actual: {1}.</value>
</data>
<data name="net_nego_channel_binding_not_supported" xml:space="preserve">
<value>No support for channel binding on operating systems other than Windows.</value>
</data>
<data name="net_ntlm_not_possible_default_cred" xml:space="preserve">
<value>NTLM authentication is not possible with default credentials on this platform.</value>
</data>
<data name="net_nego_server_not_supported" xml:space="preserve">
<value>Server implementation is not supported</value>
</data>
<data name="net_nego_protection_level_not_supported" xml:space="preserve">
<value>Requested protection level is not supported with the gssapi implementation currently installed.</value>
</data>
<data name="net_nego_not_supported_empty_target_with_defaultcreds" xml:space="preserve">
<value>Target name should be non empty if default credentials are passed.</value>
</data>
</root>

View File

@@ -0,0 +1,391 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<AssemblyName>System.Net.Security</AssemblyName>
<ProjectGuid>{89F37791-6254-4D60-AB96-ACD3CCA0E771}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);FEATURE_CORECLR</DefineConstants>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net463'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net463'">None</ResourcesSourceOutputDirectory>
</PropertyGroup>
<!-- Help VS understand available configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Unix-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Unix-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Windows_NT-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net463-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net463-Windows_NT-Release|AnyCPU'" />
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
<Compile Include="System\PinnableBufferCache.cs" />
<Compile Include="System\Net\FixedSizeReader.cs" />
<Compile Include="System\Net\HelperAsyncResults.cs" />
<Compile Include="System\Net\SslStreamContext.cs" />
<Compile Include="System\Net\Security\AuthenticatedStream.cs" />
<Compile Include="System\Net\Security\NetEventSource.Security.cs" />
<Compile Include="System\Net\Security\SecureChannel.cs" />
<Compile Include="System\Net\Security\SslSessionsCache.cs" />
<Compile Include="System\Net\Security\SslStream.cs" />
<Compile Include="System\Net\Security\SslState.cs" />
<Compile Include="System\Net\Security\SslStreamInternal.cs" />
<Compile Include="System\Net\Security\ProtectionLevel.cs" />
<Compile Include="System\Net\Security\SslConnectionInfo.cs" />
<Compile Include="System\Net\Security\StreamSizes.cs" />
<Compile Include="System\Net\Security\TlsAlertType.cs" />
<Compile Include="System\Net\Security\TlsAlertMessage.cs" />
<Compile Include="System\Security\Authentication\AuthenticationException.cs" />
<!-- NegotiateStream -->
<Compile Include="System\Net\BufferAsyncResult.cs" />
<Compile Include="System\Net\NTAuthentication.cs" />
<Compile Include="System\Net\StreamFramer.cs" />
<Compile Include="System\Net\Security\NegotiateStream.cs" />
<Compile Include="System\Net\Security\NegoState.cs" />
<Compile Include="System\Net\Security\InternalNegotiateStream.cs" />
<Compile Include="System\Security\Authentication\ExtendedProtection\ExtendedProtectionPolicy.cs" />
<Compile Include="System\Security\Authentication\ExtendedProtection\PolicyEnforcement.cs" />
<Compile Include="System\Security\Authentication\ExtendedProtection\ProtectionScenario.cs" />
<Compile Include="System\Security\Authentication\ExtendedProtection\ServiceNameCollection.cs" />
<!-- Logging -->
<Compile Include="$(CommonPath)\System\Net\Logging\DebugThreadTracking.cs">
<Link>Common\System\Net\Logging\DebugThreadTracking.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\Shims\TraceSource.cs">
<Link>Common\System\Net\Shims\TraceSource.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\Logging\NetEventSource.Common.cs">
<Link>Common\System\Net\Logging\NetEventSource.Common.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\InternalException.cs">
<Link>Common\System\Net\InternalException.cs</Link>
</Compile>
<!-- HTTP -->
<Compile Include="$(CommonPath)\System\Net\Http\TlsCertificateExtensions.cs">
<Link>Common\System\Net\Http\TlsCertificateExtensions.cs</Link>
</Compile>
<!-- Debug only -->
<Compile Include="$(CommonPath)\System\Net\DebugSafeHandle.cs">
<Link>Common\System\Net\DebugSafeHandle.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\DebugCriticalHandleMinusOneIsInvalid.cs">
<Link>Common\System\Net\DebugCriticalHandleMinusOneIsInvalid.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\DebugCriticalHandleZeroOrMinusOneIsInvalid.cs">
<Link>Common\System\Net\DebugCriticalHandleZeroOrMinusOneIsInvalid.cs</Link>
</Compile>
<!-- System.Net common -->
<Compile Include="$(CommonPath)\System\Net\ContextAwareResult.cs">
<Link>Common\System\Net\ContextAwareResult.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\ExceptionCheck.cs">
<Link>Common\System\Net\ExceptionCheck.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\IntPtrHelper.cs">
<Link>Common\System\Net\IntPtrHelper.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\LazyAsyncResult.cs">
<Link>Common\System\Net\LazyAsyncResult.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\UriScheme.cs">
<Link>Common\System\Net\UriScheme.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\SecurityProtocol.cs">
<Link>Common\System\Net\SecurityProtocol.cs</Link>
</Compile>
<!-- Common -->
<Compile Include="$(CommonPath)\System\NotImplemented.cs">
<Link>Common\System\NotImplemented.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Threading\Tasks\TaskToApm.cs">
<Link>Common\System\Threading\Tasks\TaskToApm.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\IO\Error.cs">
<Link>Common\System\IO\Error.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\Security\SecurityBuffer.cs">
<Link>Common\System\Net\Security\SecurityBuffer.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\Security\SecurityBufferType.cs">
<Link>Common\System\Net\Security\SecurityBufferType.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\Security\SSPIHandleCache.cs">
<Link>Common\System\Net\Security\SSPIHandleCache.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\ContextFlagsPal.cs">
<Link>Common\System\Net\ContextFlagsPal.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\NegotiationInfoClass.cs">
<Link>Common\System\Net\NegotiationInfoClass.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\NTAuthentication.Common.cs">
<Link>Common\System\Net\NTAuthentication.Common.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\SecurityStatusPal.cs">
<Link>Common\System\Net\SecurityStatusPal.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition=" '$(TargetsWindows)' == 'true' And '$(TargetGroup)' == 'netcoreapp' ">
<Compile Include="System\Net\CertificateValidationPal.Windows.cs" />
<Compile Include="System\Net\Security\NegotiateStreamPal.Windows.cs" />
<Compile Include="System\Net\Security\NetEventSource.Security.Windows.cs" />
<Compile Include="System\Net\Security\SslStreamPal.Windows.cs" />
<Compile Include="System\Net\Security\SslConnectionInfo.Windows.cs" />
<Compile Include="System\Net\Security\StreamSizes.Windows.cs" />
<!-- NegotiateStream -->
<Compile Include="$(CommonPath)\System\Net\SecurityStatusAdapterPal.Windows.cs">
<Link>Common\System\Net\SecurityStatusAdapterPal.Windows.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\ContextFlagsAdapterPal.Windows.cs">
<Link>Common\System\Net\ContextFlagsAdapterPal.Windows.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\Security\NegotiateStreamPal.Windows.cs">
<Link>Common\System\Net\Security\NegotiateStreamPal.Windows.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\Security\SecurityContextTokenHandle.cs">
<Link>Common\System\Net\Security\SecurityContextTokenHandle.cs</Link>
</Compile>
<!-- Interop -->
<Compile Include="$(CommonPath)\Interop\Windows\Interop.Libraries.cs">
<Link>Common\Interop\Windows\Interop.Libraries.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\Crypt32\Interop.certificates.cs">
<Link>Common\Interop\Windows\Crypt32\Interop.certificates.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\Crypt32\Interop.certificates_types.cs">
<Link>Common\Interop\Windows\Crypt32\Interop.certificates_types.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\Crypt32\Interop.CertEnumCertificatesInStore.cs">
<Link>Common\Interop\Windows\Crypt32\Interop.CertEnumCertificatesInStore.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.CloseHandle.cs">
<Link>Common\Interop\Windows\kernel32\Interop.CloseHandle.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\SChannel\Interop.Alerts.cs">
<Link>Common\Interop\Windows\SChannel\Interop.Alerts.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\SChannel\Interop.SchProtocols.cs">
<Link>Common\Interop\Windows\SChannel\Interop.SchProtocols.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\SChannel\Interop.SECURITY_STATUS.cs">
<Link>Common\Interop\Windows\SChannel\Interop.SECURITY_STATUS.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\SChannel\SecPkgContext_ConnectionInfo.cs">
<Link>Common\Interop\Windows\SChannel\SecPkgContext_ConnectionInfo.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\SChannel\UnmanagedCertificateContext.cs">
<Link>Common\Interop\Windows\SChannel\UnmanagedCertificateContext.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\sspicli\SecPkgContext_Bindings.cs">
<Link>Common\Interop\Windows\sspicli\SecPkgContext_Bindings.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\sspicli\GlobalSSPI.cs">
<Link>Common\Interop\Windows\sspicli\GlobalSSPI.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\sspicli\Interop.SSPI.cs">
<Link>Common\Interop\Windows\sspicli\Interop.SSPI.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\sspicli\SecPkgContext_NegotiationInfoW.cs">
<Link>Common\Interop\Windows\sspicli\SecPkgContext_NegotiationInfoW.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\sspicli\NegotiationInfoClass.cs">
<Link>Common\Interop\Windows\sspicli\NegotiationInfoClass.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\sspicli\SecPkgContext_Sizes.cs">
<Link>Common\Interop\Windows\sspicli\SecPkgContext_Sizes.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Collections\Generic\BidirectionalDictionary.cs">
<Link>Common\System\Collections\Generic\BidirectionalDictionary.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\sspicli\SafeDeleteContext.cs">
<Link>Common\Interop\Windows\sspicli\SafeDeleteContext.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\sspicli\SecurityPackageInfo.cs">
<Link>Common\Interop\Windows\sspicli\SecurityPackageInfo.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\sspicli\SecurityPackageInfoClass.cs">
<Link>Common\Interop\Windows\sspicli\SecurityPackageInfoClass.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\sspicli\SecuritySafeHandles.cs">
<Link>Common\Interop\Windows\sspicli\SecuritySafeHandles.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\sspicli\SSPIAuthType.cs">
<Link>Common\Interop\Windows\sspicli\SSPIAuthType.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\sspicli\SSPIInterface.cs">
<Link>Common\Interop\Windows\sspicli\SSPIInterface.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\sspicli\SSPISecureChannelType.cs">
<Link>Common\Interop\Windows\sspicli\SSPISecureChannelType.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\sspicli\SSPIWrapper.cs">
<Link>Common\Interop\Windows\sspicli\SSPIWrapper.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\sspicli\SecPkgContext_StreamSizes.cs">
<Link>Common\Interop\Windows\sspicli\SecPkgContext_StreamSizes.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\ContextAwareResult.Windows.cs">
<Link>Common\System\Net\ContextAwareResult.Windows.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition=" '$(TargetsUnix)' == 'true' ">
<Compile Include="System\Net\CertificateValidationPal.Unix.cs" />
<Compile Include="System\Net\Security\SslStreamPal.Unix.cs" />
<Compile Include="System\Net\Security\SslConnectionInfo.Unix.cs" />
<Compile Include="System\Net\Security\StreamSizes.Unix.cs" />
<Compile Include="$(CommonPath)\System\Net\Security\CertificateValidation.Unix.cs">
<Link>Common\System\Net\Security\CertificateValidation.Unix.cs</Link>
</Compile>
<!-- NegotiateStream -->
<Compile Include="$(CommonPath)\System\Net\ContextFlagsAdapterPal.Unix.cs">
<Link>Common\System\Net\ContextFlagsAdapterPal.Unix.cs</Link>
</Compile>
<Compile Include="System\Net\Security\NegotiateStreamPal.Unix.cs" />
<Compile Include="$(CommonPath)\System\Net\Security\NegotiateStreamPal.Unix.cs">
<Link>Common\System\Net\Security\NegotiateStreamPal.Unix.cs</Link>
</Compile>
<!-- Interop -->
<Compile Include="$(CommonPath)\Interop\Unix\Interop.Libraries.cs">
<Link>Common\Interop\Unix\Interop.Libraries.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\Interop.Errors.cs">
<Link>Common\Interop\Unix\Interop.Errors.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.ASN1.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.ASN1.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.BIO.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.BIO.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.ERR.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.ERR.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.Initialization.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.Initialization.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.Crypto.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.Crypto.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSsl.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSsl.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.Ssl.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.Ssl.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.SslCtx.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.SslCtx.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.SetProtocolOptions.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.SetProtocolOptions.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.SslCtxOptions.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.SslCtxOptions.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.X509.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.X509.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.X509ChannelBindingHash.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.X509ChannelBindingHash.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.X509Name.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.X509Name.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.X509Ext.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.X509Ext.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.X509Stack.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.X509Stack.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.X509StoreCtx.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.X509StoreCtx.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Net.Security.Native\Interop.Initialization.cs">
<Link>Common\Interop\Unix\System.Net.Security.Native\Interop.Initialization.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Net.Security.Native\Interop.GssApiException.cs">
<Link>Common\Interop\Unix\System.Net.Security.Native\Interop.GssApiException.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Net.Security.Native\Interop.GssBuffer.cs">
<Link>Common\Interop\Unix\System.Net.Security.Native\Interop.GssBuffer.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\GssSafeHandles.cs">
<Link>Common\Microsoft\Win32\SafeHandles\GssSafeHandles.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Net.Security.Native\Interop.NetSecurityNative.cs">
<Link>Common\Interop\Unix\System.Net.Security.Native\Interop.NetSecurityNative.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeX509Handles.Unix.cs">
<Link>Common\Microsoft\Win32\SafeHandles\SafeX509Handles.Unix.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeX509NameHandle.Unix.cs">
<Link>Common\Microsoft\Win32\SafeHandles\SafeX509NameHandle.Unix.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\X509ExtensionSafeHandles.Unix.cs">
<Link>Common\Microsoft\Win32\SafeHandles\X509ExtensionSafeHandles.Unix.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeInteriorHandle.cs">
<Link>Common\Microsoft\Win32\SafeHandles\SafeInteriorHandle.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeBioHandle.Unix.cs">
<Link>Common\Microsoft\Win32\SafeHandles\SafeBioHandle.Unix.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\Asn1SafeHandles.Unix.cs">
<Link>Common\Microsoft\Win32\SafeHandles\Asn1SafeHandles.Unix.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\ContextAwareResult.Unix.cs">
<Link>Common\System\Net\ContextAwareResult.Unix.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\Security\Unix\SafeDeleteContext.cs">
<Link>Common\System\Net\Security\Unix\SafeDeleteContext.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\Security\Unix\SafeDeleteSslContext.cs">
<Link>Common\System\Net\Security\Unix\SafeDeleteSslContext.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\Security\Unix\SafeDeleteNegoContext.cs">
<Link>Common\System\Net\Security\Unix\SafeDeleteNegoContext.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\Security\Unix\SafeFreeCertContext.cs">
<Link>Common\System\Net\Security\Unix\SafeFreeCertContext.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\Security\Unix\SafeFreeContextBufferChannelBinding.cs">
<Link>Common\System\Net\Security\Unix\SafeFreeContextBufferChannelBinding.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\Security\Unix\SafeFreeCredentials.cs">
<Link>Common\System\Net\Security\Unix\SafeFreeCredentials.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\Security\Unix\SafeFreeNegoCredentials.cs">
<Link>Common\System\Net\Security\Unix\SafeFreeNegoCredentials.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\System\Net\Security\Unix\SafeFreeSslCredentials.cs">
<Link>Common\System\Net\Security\Unix\SafeFreeSslCredentials.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'net463'">
<TargetingPackReference Include="mscorlib" />
<TargetingPackReference Include="System" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Win32.Primitives" />
<Reference Include="System.Collections" />
<Reference Include="System.Collections.Concurrent" />
<Reference Include="System.Collections.NonGeneric" />
<Reference Include="System.Diagnostics.Debug" />
<Reference Include="System.Diagnostics.Tracing" />
<Reference Include="System.Net.Primitives" />
<Reference Include="System.Resources.ResourceManager" />
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.Extensions" />
<Reference Include="System.Runtime.InteropServices" />
<Reference Include="System.Security.Claims" />
<Reference Include="System.Security.Cryptography.Encoding" />
<Reference Include="System.Security.Cryptography.X509Certificates" />
<Reference Include="System.Security.Principal" />
<Reference Include="System.Security.Principal.Windows" />
<Reference Include="System.Threading" />
<Reference Include="System.Threading.ThreadPool" />
</ItemGroup>
<ItemGroup Condition="'$(TargetsUnix)' == 'true'">
<Reference Include="System.Security.Cryptography.Algorithms" />
<Reference Include="System.Security.Cryptography.OpenSsl" />
<Reference Include="System.Security.Cryptography.Primitives" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -0,0 +1,65 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
namespace System.Net
{
//
// Preserve the original request buffer & sizes for user IO requests.
// This is returned as an IAsyncResult to the application.
//
internal sealed class BufferAsyncResult : LazyAsyncResult
{
/// <summary>Stored into LazyAsyncResult.Result to indicate a completed result.</summary>
public static readonly object ResultSentinal = nameof(BufferAsyncResult) + "." + nameof(ResultSentinal);
/// <summary>Stores the input count or the output result of the operation.</summary>
private int _countOrResult;
#if DEBUG
/// <summary>true if <see cref="_countOrResult"/> backs <see cref="Int32Result"/>, false if <see cref="Count"/>.</summary>
private bool _countOrResultIsResult;
#endif
public BufferAsyncResult(object asyncObject, byte[] buffer, int offset, int count, object asyncState, AsyncCallback asyncCallback)
: base(asyncObject, asyncState, asyncCallback)
{
Buffer = buffer;
Offset = offset;
_countOrResult = count;
}
public byte[] Buffer { get; }
public int Offset { get; }
public int Count
{
get
{
#if DEBUG
Debug.Assert(!_countOrResultIsResult, "Trying to get count after it's already the result");
#endif
return _countOrResult;
}
}
public int Int32Result // Int32Result to differentiate from the base's "object Result"
{
get
{
#if DEBUG
Debug.Assert(_countOrResultIsResult, "Still represents the count, not the result");
Debug.Assert(ReferenceEquals(Result, ResultSentinal), "Expected the base object Result to be the sentinel");
#endif
return _countOrResult;
}
set
{
#if DEBUG
Debug.Assert(!_countOrResultIsResult, "Should only be set when result hasn't yet been set");
_countOrResultIsResult = true;
#endif
_countOrResult = value;
}
}
}
}

View File

@@ -0,0 +1,198 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
using System.Globalization;
using Microsoft.Win32.SafeHandles;
using System.Net.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
namespace System.Net
{
internal static partial class CertificateValidationPal
{
private static readonly object s_lockObject = new object();
private static X509Store s_userCertStore;
internal static SslPolicyErrors VerifyCertificateProperties(
X509Chain chain,
X509Certificate2 remoteCertificate,
bool checkCertName,
bool isServer,
string hostName)
{
return CertificateValidation.BuildChainAndVerifyProperties(chain, remoteCertificate, checkCertName, hostName);
}
//
// Extracts a remote certificate upon request.
//
internal static X509Certificate2 GetRemoteCertificate(SafeDeleteContext securityContext, out X509Certificate2Collection remoteCertificateStore)
{
remoteCertificateStore = null;
bool gotReference = false;
if (securityContext == null)
{
return null;
}
if (NetEventSource.IsEnabled) NetEventSource.Enter(securityContext);
X509Certificate2 result = null;
SafeFreeCertContext remoteContext = null;
try
{
int errorCode = QueryContextRemoteCertificate(securityContext, out remoteContext);
if (remoteContext != null && !remoteContext.IsInvalid)
{
remoteContext.DangerousAddRef(ref gotReference);
result = new X509Certificate2(remoteContext.DangerousGetHandle());
}
remoteCertificateStore = new X509Certificate2Collection();
using (SafeSharedX509StackHandle chainStack =
Interop.OpenSsl.GetPeerCertificateChain(((SafeDeleteSslContext)securityContext).SslContext))
{
if (!chainStack.IsInvalid)
{
int count = Interop.Crypto.GetX509StackFieldCount(chainStack);
for (int i = 0; i < count; i++)
{
IntPtr certPtr = Interop.Crypto.GetX509StackField(chainStack, i);
if (certPtr != IntPtr.Zero)
{
// X509Certificate2(IntPtr) calls X509_dup, so the reference is appropriately tracked.
X509Certificate2 chainCert = new X509Certificate2(certPtr);
remoteCertificateStore.Add(chainCert);
}
}
}
}
}
finally
{
if (gotReference)
{
remoteContext.DangerousRelease();
}
if (remoteContext != null)
{
remoteContext.Dispose();
}
}
if (NetEventSource.IsEnabled)
{
NetEventSource.Log.RemoteCertificate(result);
NetEventSource.Exit(securityContext, result);
}
return result;
}
//
// Used only by client SSL code, never returns null.
//
internal static string[] GetRequestCertificateAuthorities(SafeDeleteContext securityContext)
{
using (SafeSharedX509NameStackHandle names = Interop.Ssl.SslGetClientCAList(((SafeDeleteSslContext)securityContext).SslContext))
{
if (names.IsInvalid)
{
return Array.Empty<string>();
}
int nameCount = Interop.Crypto.GetX509NameStackFieldCount(names);
if (nameCount == 0)
{
return Array.Empty<string>();
}
string[] clientAuthorityNames = new string[nameCount];
for (int i = 0; i < nameCount; i++)
{
using (SafeSharedX509NameHandle nameHandle = Interop.Crypto.GetX509NameStackField(names, i))
{
X500DistinguishedName dn = Interop.Crypto.LoadX500Name(nameHandle);
clientAuthorityNames[i] = dn.Name;
}
}
return clientAuthorityNames;
}
}
internal static X509Store EnsureStoreOpened(bool isMachineStore)
{
if (isMachineStore)
{
// There's not currently a LocalMachine\My store on Unix, so don't bother trying
// and having to deal with the exception.
//
// https://github.com/dotnet/corefx/issues/3690 tracks the lack of this store.
return null;
}
return EnsureStoreOpened(ref s_userCertStore, StoreLocation.CurrentUser);
}
private static X509Store EnsureStoreOpened(ref X509Store storeField, StoreLocation storeLocation)
{
X509Store store = Volatile.Read(ref storeField);
if (store == null)
{
lock (s_lockObject)
{
store = Volatile.Read(ref storeField);
if (store == null)
{
try
{
store = new X509Store(StoreName.My, storeLocation);
store.Open(OpenFlags.ReadOnly);
Volatile.Write(ref storeField, store);
if (NetEventSource.IsEnabled) NetEventSource.Info(null, $"storeLocation: {storeLocation} returned store {store}");
}
catch (CryptographicException e)
{
NetEventSource.Fail(null, $"Failed to open cert store, location: {storeLocation} exception {e}");
throw;
}
}
}
}
return store;
}
private static int QueryContextRemoteCertificate(SafeDeleteContext securityContext, out SafeFreeCertContext remoteCertContext)
{
remoteCertContext = null;
try
{
SafeX509Handle remoteCertificate = Interop.OpenSsl.GetPeerCertificate(((SafeDeleteSslContext)securityContext).SslContext);
// Note that cert ownership is transferred to SafeFreeCertContext
remoteCertContext = new SafeFreeCertContext(remoteCertificate);
return 0;
}
catch
{
return -1;
}
}
}
}

View File

@@ -0,0 +1,267 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.Win32.SafeHandles;
using System.Diagnostics;
using System.Net.Security;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Security.Principal;
using System.Threading;
namespace System.Net
{
internal static partial class CertificateValidationPal
{
private static readonly object s_syncObject = new object();
private static volatile X509Store s_myCertStoreEx;
private static volatile X509Store s_myMachineCertStoreEx;
internal static SslPolicyErrors VerifyCertificateProperties(
X509Chain chain,
X509Certificate2 remoteCertificate,
bool checkCertName,
bool isServer,
string hostName)
{
SslPolicyErrors sslPolicyErrors = SslPolicyErrors.None;
if (!chain.Build(remoteCertificate) // Build failed on handle or on policy.
&& chain.SafeHandle.DangerousGetHandle() == IntPtr.Zero) // Build failed to generate a valid handle.
{
throw new CryptographicException(Marshal.GetLastWin32Error());
}
if (checkCertName)
{
unsafe
{
uint status = 0;
var eppStruct = new Interop.Crypt32.SSL_EXTRA_CERT_CHAIN_POLICY_PARA()
{
cbSize = (uint)Marshal.SizeOf<Interop.Crypt32.SSL_EXTRA_CERT_CHAIN_POLICY_PARA>(),
dwAuthType = isServer ? Interop.Crypt32.AuthType.AUTHTYPE_SERVER : Interop.Crypt32.AuthType.AUTHTYPE_CLIENT,
fdwChecks = 0,
pwszServerName = null
};
var cppStruct = new Interop.Crypt32.CERT_CHAIN_POLICY_PARA()
{
cbSize = (uint)Marshal.SizeOf<Interop.Crypt32.CERT_CHAIN_POLICY_PARA>(),
dwFlags = 0,
pvExtraPolicyPara = &eppStruct
};
fixed (char* namePtr = hostName)
{
eppStruct.pwszServerName = namePtr;
cppStruct.dwFlags |=
(Interop.Crypt32.CertChainPolicyIgnoreFlags.CERT_CHAIN_POLICY_IGNORE_ALL &
~Interop.Crypt32.CertChainPolicyIgnoreFlags.CERT_CHAIN_POLICY_IGNORE_INVALID_NAME_FLAG);
SafeX509ChainHandle chainContext = chain.SafeHandle;
status = Verify(chainContext, ref cppStruct);
if (status == Interop.Crypt32.CertChainPolicyErrors.CERT_E_CN_NO_MATCH)
{
sslPolicyErrors |= SslPolicyErrors.RemoteCertificateNameMismatch;
}
}
}
}
X509ChainStatus[] chainStatusArray = chain.ChainStatus;
if (chainStatusArray != null && chainStatusArray.Length != 0)
{
sslPolicyErrors |= SslPolicyErrors.RemoteCertificateChainErrors;
}
return sslPolicyErrors;
}
//
// Extracts a remote certificate upon request.
//
internal static X509Certificate2 GetRemoteCertificate(SafeDeleteContext securityContext, out X509Certificate2Collection remoteCertificateCollection)
{
remoteCertificateCollection = null;
if (securityContext == null)
{
return null;
}
if (NetEventSource.IsEnabled) NetEventSource.Enter(securityContext);
X509Certificate2 result = null;
SafeFreeCertContext remoteContext = null;
try
{
remoteContext = SSPIWrapper.QueryContextAttributes(GlobalSSPI.SSPISecureChannel, securityContext, Interop.SspiCli.ContextAttribute.SECPKG_ATTR_REMOTE_CERT_CONTEXT) as SafeFreeCertContext;
if (remoteContext != null && !remoteContext.IsInvalid)
{
result = new X509Certificate2(remoteContext.DangerousGetHandle());
}
}
finally
{
if (remoteContext != null && !remoteContext.IsInvalid)
{
remoteCertificateCollection = UnmanagedCertificateContext.GetRemoteCertificatesFromStoreContext(remoteContext);
remoteContext.Dispose();
}
}
if (NetEventSource.IsEnabled)
{
NetEventSource.Log.RemoteCertificate(result);
NetEventSource.Exit(null, result, securityContext);
}
return result;
}
//
// Used only by client SSL code, never returns null.
//
internal static string[] GetRequestCertificateAuthorities(SafeDeleteContext securityContext)
{
Interop.SspiCli.SecPkgContext_IssuerListInfoEx issuerList =
(Interop.SspiCli.SecPkgContext_IssuerListInfoEx)SSPIWrapper.QueryContextAttributes(
GlobalSSPI.SSPISecureChannel,
securityContext,
Interop.SspiCli.ContextAttribute.SECPKG_ATTR_ISSUER_LIST_EX);
string[] issuers = Array.Empty<string>();
try
{
if (issuerList.cIssuers > 0)
{
unsafe
{
uint count = issuerList.cIssuers;
issuers = new string[issuerList.cIssuers];
Interop.SspiCli.CERT_CHAIN_ELEMENT* pIL = (Interop.SspiCli.CERT_CHAIN_ELEMENT*)issuerList.aIssuers.DangerousGetHandle();
for (int i = 0; i < count; ++i)
{
Interop.SspiCli.CERT_CHAIN_ELEMENT* pIL2 = pIL + i;
if (pIL2->cbSize <= 0)
{
NetEventSource.Fail(securityContext, $"Interop.SspiCli._CERT_CHAIN_ELEMENT size is not positive: {pIL2->cbSize}");
}
if (pIL2->cbSize > 0)
{
uint size = pIL2->cbSize;
byte* ptr = (byte*)(pIL2->pCertContext);
byte[] x = new byte[size];
for (int j = 0; j < size; j++)
{
x[j] = *(ptr + j);
}
X500DistinguishedName x500DistinguishedName = new X500DistinguishedName(x);
issuers[i] = x500DistinguishedName.Name;
if (NetEventSource.IsEnabled) NetEventSource.Info(securityContext, "IssuerListEx[{issuers[i]}]");
}
}
}
}
}
finally
{
if (issuerList.aIssuers != null)
{
issuerList.aIssuers.Dispose();
}
}
return issuers;
}
//
// Security: We temporarily reset thread token to open the cert store under process account.
//
internal static X509Store EnsureStoreOpened(bool isMachineStore)
{
X509Store store = isMachineStore ? s_myMachineCertStoreEx : s_myCertStoreEx;
// TODO #3862 Investigate if this can be switched to either the static or Lazy<T> patterns.
if (store == null)
{
lock (s_syncObject)
{
store = isMachineStore ? s_myMachineCertStoreEx : s_myCertStoreEx;
if (store == null)
{
// NOTE: that if this call fails we won't keep track and the next time we enter we will try to open the store again.
StoreLocation storeLocation = isMachineStore ? StoreLocation.LocalMachine : StoreLocation.CurrentUser;
store = new X509Store(StoreName.My, storeLocation);
try
{
// For app-compat We want to ensure the store is opened under the **process** account.
try
{
WindowsIdentity.RunImpersonated(SafeAccessTokenHandle.InvalidHandle, () =>
{
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
if (NetEventSource.IsEnabled) NetEventSource.Info(null, $"storeLocation {storeLocation} returned store: {store}");
});
}
catch
{
throw;
}
if (isMachineStore)
{
s_myMachineCertStoreEx = store;
}
else
{
s_myCertStoreEx = store;
}
return store;
}
catch (Exception exception)
{
if (exception is CryptographicException || exception is SecurityException)
{
NetEventSource.Fail(null, $"Failed to open cert store, location: {storeLocation} exception: {exception}");
return null;
}
if (NetEventSource.IsEnabled) NetEventSource.Error(null, SR.Format(SR.net_log_open_store_failed, storeLocation, exception));
throw;
}
}
}
}
return store;
}
private static uint Verify(SafeX509ChainHandle chainContext, ref Interop.Crypt32.CERT_CHAIN_POLICY_PARA cpp)
{
if (NetEventSource.IsEnabled) NetEventSource.Enter(chainContext, cpp.dwFlags);
var status = new Interop.Crypt32.CERT_CHAIN_POLICY_STATUS();
status.cbSize = (uint)Marshal.SizeOf<Interop.Crypt32.CERT_CHAIN_POLICY_STATUS>();
bool errorCode =
Interop.Crypt32.CertVerifyCertificateChainPolicy(
(IntPtr)Interop.Crypt32.CertChainPolicy.CERT_CHAIN_POLICY_SSL,
chainContext,
ref cpp,
ref status);
if (NetEventSource.IsEnabled) NetEventSource.Info(chainContext, $"CertVerifyCertificateChainPolicy returned: {errorCode}. Status: {status.dwError}");
return status.dwError;
}
}
}

View File

@@ -0,0 +1,168 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
namespace System.Net
{
//
// The class is a simple wrapper on top of a read stream. It will read the exact number of bytes requested.
// It will throw if EOF is reached before the expected number of bytes is returned.
//
internal class FixedSizeReader
{
private static readonly AsyncCallback s_readCallback = new AsyncCallback(ReadCallback);
private readonly Stream _transport;
private AsyncProtocolRequest _request;
private int _totalRead;
public FixedSizeReader(Stream transport)
{
_transport = transport;
}
//
// Returns 0 on legitimate EOF or if 0 bytes were requested, otherwise reads as directed or throws.
// Returns count on success.
//
public int ReadPacket(byte[] buffer, int offset, int count)
{
int tempCount = count;
do
{
int bytes = _transport.Read(buffer, offset, tempCount);
if (bytes == 0)
{
if (tempCount != count)
{
throw new IOException(SR.net_io_eof);
}
return 0;
}
tempCount -= bytes;
offset += bytes;
} while (tempCount != 0);
return count;
}
//
// Completes "_Request" with 0 if 0 bytes was requested or legitimate EOF received.
// Otherwise, reads as directed or completes "_Request" with an Exception or throws.
//
public void AsyncReadPacket(AsyncProtocolRequest request)
{
_request = request;
_totalRead = 0;
StartReading();
}
//
// Loops while subsequent completions are sync.
//
private void StartReading()
{
while (true)
{
int bytes;
Task<int> t = _transport.ReadAsync(_request.Buffer, _request.Offset + _totalRead, _request.Count - _totalRead);
if (t.IsCompleted)
{
bytes = t.GetAwaiter().GetResult();
}
else
{
IAsyncResult ar = TaskToApm.Begin(t, s_readCallback, this);
if (!ar.CompletedSynchronously)
{
#if DEBUG
_request._DebugAsyncChain = ar;
#endif
break;
}
bytes = TaskToApm.End<int>(ar);
}
if (CheckCompletionBeforeNextRead(bytes))
{
break;
}
}
}
private bool CheckCompletionBeforeNextRead(int bytes)
{
if (bytes == 0)
{
// 0 bytes was requested or EOF in the beginning of a frame, the caller should decide whether it's OK.
if (_totalRead == 0)
{
_request.CompleteRequest(0);
return true;
}
// EOF in the middle of a frame.
throw new IOException(SR.net_io_eof);
}
if (_totalRead + bytes > _request.Count)
{
NetEventSource.Fail(this, $"State got out of range. Total:{_totalRead + bytes} Count:{_request.Count}");
}
if ((_totalRead += bytes) == _request.Count)
{
_request.CompleteRequest(_request.Count);
return true;
}
return false;
}
private static void ReadCallback(IAsyncResult transportResult)
{
if (!(transportResult.AsyncState is FixedSizeReader))
{
NetEventSource.Fail(null, "State type is wrong, expected FixedSizeReader.");
}
if (transportResult.CompletedSynchronously)
{
return;
}
FixedSizeReader reader = (FixedSizeReader)transportResult.AsyncState;
AsyncProtocolRequest request = reader._request;
// Async completion.
try
{
int bytes = TaskToApm.End<int>(transportResult);
if (reader.CheckCompletionBeforeNextRead(bytes))
{
return;
}
reader.StartReading();
}
catch (Exception e)
{
if (request.IsUserCompleted)
{
throw;
}
request.CompleteUserWithError(e);
}
}
}
}

View File

@@ -0,0 +1,149 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
using System.Threading;
namespace System.Net
{
// The callback type used with below AsyncProtocolRequest class
internal delegate void AsyncProtocolCallback(AsyncProtocolRequest asyncRequest);
//
// The class mimics LazyAsyncResult although it does not need to be thread safe nor it does need an Event.
// We use this to implement iterative protocol logic:
// 1) It can be reused for handshake-like or multi-IO request protocols.
// 2) It won't block async IO since there is NO event handler exposed.
//
// UserAsyncResult property is a link into original user IO request (could be a BufferAsyncResult).
//
internal class AsyncProtocolRequest
{
#if DEBUG
internal object _DebugAsyncChain; // Optionally used to track chains of async calls.
#endif
private AsyncProtocolCallback _callback;
private int _completionStatus;
private const int StatusNotStarted = 0;
private const int StatusCompleted = 1;
private const int StatusCheckedOnSyncCompletion = 2;
public LazyAsyncResult UserAsyncResult;
public int Result;
public object AsyncState;
public byte[] Buffer; // Temporary buffer reused by a protocol.
public int Offset;
public int Count;
public AsyncProtocolRequest(LazyAsyncResult userAsyncResult)
{
if (userAsyncResult == null)
{
NetEventSource.Fail(this, "userAsyncResult == null");
}
if (userAsyncResult.InternalPeekCompleted)
{
NetEventSource.Fail(this, "userAsyncResult is already completed.");
}
UserAsyncResult = userAsyncResult;
}
public void Reset(LazyAsyncResult userAsyncResult)
{
if (userAsyncResult == null)
{
NetEventSource.Fail(this, "userAsyncResult == null");
}
if (userAsyncResult.InternalPeekCompleted)
{
NetEventSource.Fail(this, "userAsyncResult is already completed.");
}
UserAsyncResult = userAsyncResult;
_callback = null;
_completionStatus = 0;
Result = 0;
AsyncState = null;
Buffer = null;
Offset = 0;
Count = 0;
#if DEBUG
_DebugAsyncChain = 0;
#endif
}
public void SetNextRequest(byte[] buffer, int offset, int count, AsyncProtocolCallback callback)
{
if (_completionStatus != StatusNotStarted)
{
throw new InternalException(); // Pending operation is in progress.
}
Buffer = buffer;
Offset = offset;
Count = count;
_callback = callback;
}
internal object AsyncObject => UserAsyncResult.AsyncObject;
//
// Notify protocol so a next stage could be started.
//
internal void CompleteRequest(int result)
{
Result = result;
int status = Interlocked.Exchange(ref _completionStatus, StatusCompleted);
if (status == StatusCompleted)
{
throw new InternalException(); // Only allow one call.
}
if (status == StatusCheckedOnSyncCompletion)
{
_completionStatus = StatusNotStarted;
_callback(this);
}
}
public bool MustCompleteSynchronously
{
get
{
int status = Interlocked.Exchange(ref _completionStatus, StatusCheckedOnSyncCompletion);
if (status == StatusCheckedOnSyncCompletion)
{
throw new InternalException(); // Only allow one call.
}
if (status == StatusCompleted)
{
_completionStatus = StatusNotStarted;
return true;
}
return false;
}
}
//
// Important: This will abandon _Callback and directly notify UserAsyncResult.
//
internal void CompleteUserWithError(Exception e) => UserAsyncResult.InvokeCallback(e);
internal void CompleteUser() => UserAsyncResult.InvokeCallback();
internal void CompleteUser(int userResult)
{
Debug.Assert(UserAsyncResult is BufferAsyncResult, "CompleteUser(int) may only be used with a BufferAsyncResult");
var bar = (BufferAsyncResult)UserAsyncResult;
bar.Int32Result = userResult;
bar.InvokeCallback(BufferAsyncResult.ResultSentinal);
}
internal bool IsUserCompleted => UserAsyncResult.InternalPeekCompleted;
}
}

View File

@@ -0,0 +1,141 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Net.Security;
using System.Security.Authentication.ExtendedProtection;
using System.Threading;
namespace System.Net
{
internal partial class NTAuthentication
{
private static ContextCallback s_InitializeCallback = new ContextCallback(InitializeCallback);
internal string AssociatedName
{
get
{
if (!(IsValidContext && IsCompleted))
{
throw new Win32Exception((int)SecurityStatusPalErrorCode.InvalidHandle);
}
string name = NegotiateStreamPal.QueryContextAssociatedName(_securityContext);
if (NetEventSource.IsEnabled) NetEventSource.Info(this, $"NTAuthentication: The context is associated with [{name}]");
return name;
}
}
internal bool IsConfidentialityFlag
{
get
{
return (_contextFlags & ContextFlagsPal.Confidentiality) != 0;
}
}
internal bool IsIntegrityFlag
{
get
{
return (_contextFlags & (_isServer ? ContextFlagsPal.AcceptIntegrity : ContextFlagsPal.InitIntegrity)) != 0;
}
}
internal bool IsMutualAuthFlag
{
get
{
return (_contextFlags & ContextFlagsPal.MutualAuth) != 0;
}
}
internal bool IsDelegationFlag
{
get
{
return (_contextFlags & ContextFlagsPal.Delegate) != 0;
}
}
internal bool IsIdentifyFlag
{
get
{
return (_contextFlags & (_isServer ? ContextFlagsPal.AcceptIdentify : ContextFlagsPal.InitIdentify)) != 0;
}
}
internal string Spn
{
get
{
return _spn;
}
}
internal bool IsNTLM
{
get
{
if (_lastProtocolName == null)
{
_lastProtocolName = ProtocolName;
}
return (object)_lastProtocolName == (object)NegotiationInfoClass.NTLM;
}
}
private class InitializeCallbackContext
{
internal InitializeCallbackContext(NTAuthentication thisPtr, bool isServer, string package, NetworkCredential credential, string spn, ContextFlagsPal requestedContextFlags, ChannelBinding channelBinding)
{
ThisPtr = thisPtr;
IsServer = isServer;
Package = package;
Credential = credential;
Spn = spn;
RequestedContextFlags = requestedContextFlags;
ChannelBinding = channelBinding;
}
internal readonly NTAuthentication ThisPtr;
internal readonly bool IsServer;
internal readonly string Package;
internal readonly NetworkCredential Credential;
internal readonly string Spn;
internal readonly ContextFlagsPal RequestedContextFlags;
internal readonly ChannelBinding ChannelBinding;
}
private static void InitializeCallback(object state)
{
InitializeCallbackContext context = (InitializeCallbackContext)state;
context.ThisPtr.Initialize(context.IsServer, context.Package, context.Credential, context.Spn, context.RequestedContextFlags, context.ChannelBinding);
}
internal int Encrypt(byte[] buffer, int offset, int count, ref byte[] output, uint sequenceNumber)
{
return NegotiateStreamPal.Encrypt(
_securityContext,
buffer,
offset,
count,
IsConfidentialityFlag,
IsNTLM,
ref output,
sequenceNumber);
}
internal int Decrypt(byte[] payload, int offset, int count, out int newOffset, uint expectedSeqNumber)
{
return NegotiateStreamPal.Decrypt(_securityContext, payload, offset, count, IsConfidentialityFlag, IsNTLM, out newOffset, expectedSeqNumber);
}
}
}

View File

@@ -0,0 +1,85 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.IO;
namespace System.Net.Security
{
// A public contract for a base abstract authenticated stream.
public abstract class AuthenticatedStream : Stream
{
private Stream _innerStream;
private bool _leaveStreamOpen;
protected AuthenticatedStream(Stream innerStream, bool leaveInnerStreamOpen)
{
if (innerStream == null || innerStream == Stream.Null)
{
throw new ArgumentNullException(nameof(innerStream));
}
if (!innerStream.CanRead || !innerStream.CanWrite)
{
throw new ArgumentException(SR.net_io_must_be_rw_stream, nameof(innerStream));
}
_innerStream = innerStream;
_leaveStreamOpen = leaveInnerStreamOpen;
}
public bool LeaveInnerStreamOpen
{
get
{
return _leaveStreamOpen;
}
}
protected Stream InnerStream
{
get
{
return _innerStream;
}
}
protected override void Dispose(bool disposing)
{
#if DEBUG
using (DebugThreadTracking.SetThreadKind(ThreadKinds.User))
{
#endif
try
{
if (disposing)
{
if (_leaveStreamOpen)
{
_innerStream.Flush();
}
else
{
_innerStream.Dispose();
}
}
}
finally
{
base.Dispose(disposing);
}
#if DEBUG
}
#endif
}
public abstract bool IsAuthenticated { get; }
public abstract bool IsMutuallyAuthenticated { get; }
public abstract bool IsEncrypted { get; }
public abstract bool IsSigned { get; }
public abstract bool IsServer { get; }
}
}

View File

@@ -0,0 +1,450 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace System.Net.Security
{
//
// This is a wrapping stream that does data encryption/decryption based on a successfully authenticated SSPI context.
// This file contains the private implementation.
//
public partial class NegotiateStream : AuthenticatedStream
{
private static AsyncCallback s_writeCallback = new AsyncCallback(WriteCallback);
private static AsyncProtocolCallback s_readCallback = new AsyncProtocolCallback(ReadCallback);
private int _NestedWrite;
private int _NestedRead;
private byte[] _ReadHeader;
// Never updated directly, special properties are used.
private byte[] _InternalBuffer;
private int _InternalOffset;
private int _InternalBufferCount;
private FixedSizeReader _FrameReader;
private void InitializeStreamPart()
{
_ReadHeader = new byte[4];
_FrameReader = new FixedSizeReader(InnerStream);
}
private byte[] InternalBuffer
{
get
{
return _InternalBuffer;
}
}
private int InternalOffset
{
get
{
return _InternalOffset;
}
}
private int InternalBufferCount
{
get
{
return _InternalBufferCount;
}
}
private void DecrementInternalBufferCount(int decrCount)
{
_InternalOffset += decrCount;
_InternalBufferCount -= decrCount;
}
private void EnsureInternalBufferSize(int bytes)
{
_InternalBufferCount = bytes;
_InternalOffset = 0;
if (InternalBuffer == null || InternalBuffer.Length < bytes)
{
_InternalBuffer = new byte[bytes];
}
}
private void AdjustInternalBufferOffsetSize(int bytes, int offset)
{
_InternalBufferCount = bytes;
_InternalOffset = offset;
}
//
// Validates user parameters for all Read/Write methods.
//
private void ValidateParameters(byte[] buffer, int offset, int count)
{
if (buffer == null)
{
throw new ArgumentNullException(nameof(buffer));
}
if (offset < 0)
{
throw new ArgumentOutOfRangeException(nameof(offset));
}
if (count < 0)
{
throw new ArgumentOutOfRangeException(nameof(count));
}
if (count > buffer.Length - offset)
{
throw new ArgumentOutOfRangeException(nameof(count), SR.net_offset_plus_count);
}
}
//
// Combined sync/async write method. For sync request asyncRequest==null.
//
private void ProcessWrite(byte[] buffer, int offset, int count, AsyncProtocolRequest asyncRequest)
{
ValidateParameters(buffer, offset, count);
if (Interlocked.Exchange(ref _NestedWrite, 1) == 1)
{
throw new NotSupportedException(SR.Format(SR.net_io_invalidnestedcall, (asyncRequest != null ? "BeginWrite" : "Write"), "write"));
}
bool failed = false;
try
{
StartWriting(buffer, offset, count, asyncRequest);
}
catch (Exception e)
{
failed = true;
if (e is IOException)
{
throw;
}
throw new IOException(SR.net_io_write, e);
}
finally
{
if (asyncRequest == null || failed)
{
_NestedWrite = 0;
}
}
}
private void StartWriting(byte[] buffer, int offset, int count, AsyncProtocolRequest asyncRequest)
{
// We loop to this method from the callback.
// If the last chunk was just completed from async callback (count < 0), we complete user request.
if (count >= 0)
{
byte[] outBuffer = null;
do
{
int chunkBytes = Math.Min(count, NegoState.MaxWriteDataSize);
int encryptedBytes;
try
{
encryptedBytes = _negoState.EncryptData(buffer, offset, chunkBytes, ref outBuffer);
}
catch (Exception e)
{
throw new IOException(SR.net_io_encrypt, e);
}
if (asyncRequest != null)
{
// prepare for the next request
asyncRequest.SetNextRequest(buffer, offset + chunkBytes, count - chunkBytes, null);
Task t = InnerStream.WriteAsync(outBuffer, 0, encryptedBytes);
if (t.IsCompleted)
{
t.GetAwaiter().GetResult();
}
else
{
IAsyncResult ar = TaskToApm.Begin(t, s_writeCallback, asyncRequest);
if (!ar.CompletedSynchronously)
{
return;
}
TaskToApm.End(ar);
}
}
else
{
InnerStream.Write(outBuffer, 0, encryptedBytes);
}
offset += chunkBytes;
count -= chunkBytes;
} while (count != 0);
}
if (asyncRequest != null)
{
asyncRequest.CompleteUser();
}
}
//
// Combined sync/async read method. For sync request asyncRequest==null.
// There is a little overhead because we need to pass buffer/offset/count used only in sync.
// Still the benefit is that we have a common sync/async code path.
//
private int ProcessRead(byte[] buffer, int offset, int count, AsyncProtocolRequest asyncRequest)
{
ValidateParameters(buffer, offset, count);
if (Interlocked.Exchange(ref _NestedRead, 1) == 1)
{
throw new NotSupportedException(SR.Format(SR.net_io_invalidnestedcall, (asyncRequest != null ? "BeginRead" : "Read"), "read"));
}
bool failed = false;
try
{
if (InternalBufferCount != 0)
{
int copyBytes = InternalBufferCount > count ? count : InternalBufferCount;
if (copyBytes != 0)
{
Buffer.BlockCopy(InternalBuffer, InternalOffset, buffer, offset, copyBytes);
DecrementInternalBufferCount(copyBytes);
}
asyncRequest?.CompleteUser(copyBytes);
return copyBytes;
}
// Performing actual I/O.
return StartReading(buffer, offset, count, asyncRequest);
}
catch (Exception e)
{
failed = true;
if (e is IOException)
{
throw;
}
throw new IOException(SR.net_io_read, e);
}
finally
{
if (asyncRequest == null || failed)
{
_NestedRead = 0;
}
}
}
//
// To avoid recursion when 0 bytes have been decrypted, loop until decryption results in at least 1 byte.
//
private int StartReading(byte[] buffer, int offset, int count, AsyncProtocolRequest asyncRequest)
{
int result;
// When we read -1 bytes means we have decrypted 0 bytes, need looping.
while ((result = StartFrameHeader(buffer, offset, count, asyncRequest)) == -1);
return result;
}
private int StartFrameHeader(byte[] buffer, int offset, int count, AsyncProtocolRequest asyncRequest)
{
int readBytes = 0;
if (asyncRequest != null)
{
asyncRequest.SetNextRequest(_ReadHeader, 0, _ReadHeader.Length, s_readCallback);
_FrameReader.AsyncReadPacket(asyncRequest);
if (!asyncRequest.MustCompleteSynchronously)
{
return 0;
}
readBytes = asyncRequest.Result;
}
else
{
readBytes = _FrameReader.ReadPacket(_ReadHeader, 0, _ReadHeader.Length);
}
return StartFrameBody(readBytes, buffer, offset, count, asyncRequest);
}
private int StartFrameBody(int readBytes, byte[] buffer, int offset, int count, AsyncProtocolRequest asyncRequest)
{
if (readBytes == 0)
{
//EOF
asyncRequest?.CompleteUser(0);
return 0;
}
if (!(readBytes == _ReadHeader.Length))
{
NetEventSource.Fail(this, $"Frame size must be 4 but received {readBytes} bytes.");
}
// Replace readBytes with the body size recovered from the header content.
readBytes = _ReadHeader[3];
readBytes = (readBytes << 8) | _ReadHeader[2];
readBytes = (readBytes << 8) | _ReadHeader[1];
readBytes = (readBytes << 8) | _ReadHeader[0];
//
// The body carries 4 bytes for trailer size slot plus trailer, hence <=4 frame size is always an error.
// Additionally we'd like to restrict the read frame size to 64k.
//
if (readBytes <= 4 || readBytes > NegoState.MaxReadFrameSize)
{
throw new IOException(SR.net_frame_read_size);
}
//
// Always pass InternalBuffer for SSPI "in place" decryption.
// A user buffer can be shared by many threads in that case decryption/integrity check may fail cause of data corruption.
//
EnsureInternalBufferSize(readBytes);
if (asyncRequest != null)
{
asyncRequest.SetNextRequest(InternalBuffer, 0, readBytes, s_readCallback);
_FrameReader.AsyncReadPacket(asyncRequest);
if (!asyncRequest.MustCompleteSynchronously)
{
return 0;
}
readBytes = asyncRequest.Result;
}
else //Sync
{
readBytes = _FrameReader.ReadPacket(InternalBuffer, 0, readBytes);
}
return ProcessFrameBody(readBytes, buffer, offset, count, asyncRequest);
}
private int ProcessFrameBody(int readBytes, byte[] buffer, int offset, int count, AsyncProtocolRequest asyncRequest)
{
if (readBytes == 0)
{
// We already checked that the frame body is bigger than 0 bytes
// Hence, this is an EOF ... fire.
throw new IOException(SR.net_io_eof);
}
// Decrypt into internal buffer, change "readBytes" to count now _Decrypted Bytes_
int internalOffset;
readBytes = _negoState.DecryptData(InternalBuffer, 0, readBytes, out internalOffset);
// Decrypted data start from zero offset, the size can be shrunk after decryption.
AdjustInternalBufferOffsetSize(readBytes, internalOffset);
if (readBytes == 0 && count != 0)
{
// Read again.
return -1;
}
if (readBytes > count)
{
readBytes = count;
}
Buffer.BlockCopy(InternalBuffer, InternalOffset, buffer, offset, readBytes);
// This will adjust both the remaining internal buffer count and the offset.
DecrementInternalBufferCount(readBytes);
asyncRequest?.CompleteUser(readBytes);
return readBytes;
}
private static void WriteCallback(IAsyncResult transportResult)
{
if (transportResult.CompletedSynchronously)
{
return;
}
if (!(transportResult.AsyncState is AsyncProtocolRequest))
{
NetEventSource.Fail(transportResult, "State type is wrong, expected AsyncProtocolRequest.");
}
AsyncProtocolRequest asyncRequest = (AsyncProtocolRequest)transportResult.AsyncState;
try
{
NegotiateStream negoStream = (NegotiateStream)asyncRequest.AsyncObject;
TaskToApm.End(transportResult);
if (asyncRequest.Count == 0)
{
// This was the last chunk.
asyncRequest.Count = -1;
}
negoStream.StartWriting(asyncRequest.Buffer, asyncRequest.Offset, asyncRequest.Count, asyncRequest);
}
catch (Exception e)
{
if (asyncRequest.IsUserCompleted)
{
// This will throw on a worker thread.
throw;
}
asyncRequest.CompleteUserWithError(e);
}
}
private static void ReadCallback(AsyncProtocolRequest asyncRequest)
{
// Async ONLY completion.
try
{
NegotiateStream negoStream = (NegotiateStream)asyncRequest.AsyncObject;
BufferAsyncResult bufferResult = (BufferAsyncResult)asyncRequest.UserAsyncResult;
// This is an optimization to avoid an additional callback.
if ((object)asyncRequest.Buffer == (object)negoStream._ReadHeader)
{
negoStream.StartFrameBody(asyncRequest.Result, bufferResult.Buffer, bufferResult.Offset, bufferResult.Count, asyncRequest);
}
else
{
if (-1 == negoStream.ProcessFrameBody(asyncRequest.Result, bufferResult.Buffer, bufferResult.Offset, bufferResult.Count, asyncRequest))
{
// In case we decrypted 0 bytes, start another reading.
negoStream.StartReading(bufferResult.Buffer, bufferResult.Offset, bufferResult.Count, asyncRequest);
}
}
}
catch (Exception e)
{
if (asyncRequest.IsUserCompleted)
{
// This will throw on a worker thread.
throw;
}
asyncRequest.CompleteUserWithError(e);
}
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,50 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.IO;
using System.Security;
using System.Security.Principal;
using System.Threading;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security.Authentication;
using System.Security.Authentication.ExtendedProtection;
using Microsoft.Win32.SafeHandles;
namespace System.Net.Security
{
//
// The class maintains the state of the authentication process and the security context.
// It encapsulates security context and does the real work in authentication and
// user data encryption with NEGO SSPI package.
//
internal static partial class NegotiateStreamPal
{
internal static IIdentity GetIdentity(NTAuthentication context)
{
Debug.Assert(!context.IsServer, "GetIdentity: Server is not supported");
string name = context.Spn;
string protocol = context.ProtocolName;
return new GenericIdentity(name, protocol);
}
internal static string QueryContextAssociatedName(SafeDeleteContext securityContext)
{
throw new PlatformNotSupportedException(SR.net_nego_server_not_supported);
}
internal static void ValidateImpersonationLevel(TokenImpersonationLevel impersonationLevel)
{
if (impersonationLevel != TokenImpersonationLevel.Identification)
{
throw new ArgumentOutOfRangeException(nameof(impersonationLevel), impersonationLevel.ToString(),
SR.net_auth_supported_impl_levels);
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More