You've already forked linux-packaging-mono
Imported Upstream version 5.2.0.175
Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
parent
4bdbaf4a88
commit
966bba02bb
@@ -1,16 +1,10 @@
|
||||
|
||||
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
|
||||
{} = {}
|
||||
{89F37791-6254-4D60-AB96-ACD3CCA0E771} = {89F37791-6254-4D60-AB96-ACD3CCA0E771}
|
||||
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}"
|
||||
@@ -18,119 +12,49 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Net.Security.Unit.Te
|
||||
{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}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{A7488FC0-9A8F-4EF9-BC3E-C5EBA47E13F8} = {A7488FC0-9A8F-4EF9-BC3E-C5EBA47E13F8}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FunctionalTests", "FunctionalTests", "{7665987C-3533-4785-9EBC-C1B76A433CD6}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Net.Security", "ref\System.Net.Security.csproj", "{A7488FC0-9A8F-4EF9-BC3E-C5EBA47E13F8}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "UnitTests", "UnitTests", "{2C9E787E-150A-4C0F-979B-0E28FAC45BAA}"
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1A2F9F4A-A032-433E-B914-ADD5992BB178}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E107E9C1-E893-4E87-987E-04EF0DCEAEFD}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{2E666815-2EDB-464B-9DF6-380BF4789AD4}"
|
||||
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
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
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
|
||||
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.Debug|Any CPU.ActiveCfg = netstandard-Windows_NT-Debug|Any CPU
|
||||
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.Debug|Any CPU.Build.0 = netstandard-Windows_NT-Debug|Any CPU
|
||||
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.Release|Any CPU.ActiveCfg = netstandard-Windows_NT-Release|Any CPU
|
||||
{0D174EA9-9E61-4519-8D31-7BD2331A1982}.Release|Any CPU.Build.0 = netstandard-Windows_NT-Release|Any CPU
|
||||
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.Debug|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.Debug|Any CPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.Release|Any CPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{89F37791-6254-4D60-AB96-ACD3CCA0E771}.Release|Any CPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{A7488FC0-9A8F-4EF9-BC3E-C5EBA47E13F8}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{A7488FC0-9A8F-4EF9-BC3E-C5EBA47E13F8}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{A7488FC0-9A8F-4EF9-BC3E-C5EBA47E13F8}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{A7488FC0-9A8F-4EF9-BC3E-C5EBA47E13F8}.Release|Any CPU.Build.0 = netcoreapp-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}
|
||||
{A55A2B9A-830F-4330-A0E7-02A9FB30ABD2} = {1A2F9F4A-A032-433E-B914-ADD5992BB178}
|
||||
{0D174EA9-9E61-4519-8D31-7BD2331A1982} = {1A2F9F4A-A032-433E-B914-ADD5992BB178}
|
||||
{89F37791-6254-4D60-AB96-ACD3CCA0E771} = {E107E9C1-E893-4E87-987E-04EF0DCEAEFD}
|
||||
{A7488FC0-9A8F-4EF9-BC3E-C5EBA47E13F8} = {2E666815-2EDB-464B-9DF6-380BF4789AD4}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>4.1.0.0</AssemblyVersion>
|
||||
<IsNETCoreApp>true</IsNETCoreApp>
|
||||
<IsUAP>true</IsUAP>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?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>
|
||||
@@ -1,6 +1,9 @@
|
||||
<?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>
|
||||
<ProjectGuid>{A7488FC0-9A8F-4EF9-BC3E-C5EBA47E13F8}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Debug|AnyCPU'" />
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
netcoreapp-OSX;
|
||||
netcoreapp-Unix;
|
||||
netcoreapp-Windows_NT;
|
||||
net463-Windows_NT;
|
||||
uap-Windows_NT;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
16
external/corefx/src/System.Net.Security/src/PinvokeAnalyzerExceptionList.analyzerdata
vendored
Normal file
16
external/corefx/src/System.Net.Security/src/PinvokeAnalyzerExceptionList.analyzerdata
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
sspicli.dll!AcceptSecurityContext
|
||||
sspicli.dll!AcquireCredentialsHandleW
|
||||
sspicli.dll!ApplyControlToken
|
||||
sspicli.dll!CompleteAuthToken
|
||||
sspicli.dll!DecryptMessage
|
||||
sspicli.dll!DeleteSecurityContext
|
||||
sspicli.dll!EncryptMessage
|
||||
sspicli.dll!EnumerateSecurityPackagesW
|
||||
sspicli.dll!FreeContextBuffer
|
||||
sspicli.dll!FreeCredentialsHandle
|
||||
sspicli.dll!InitializeSecurityContextW
|
||||
sspicli.dll!QueryContextAttributesW
|
||||
sspicli.dll!QuerySecurityContextToken
|
||||
sspicli.dll!SetContextAttributesW
|
||||
sspicli.dll!SspiEncodeStringsAsAuthIdentity
|
||||
sspicli.dll!SspiFreeAuthIdentity
|
||||
@@ -1,64 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?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">
|
||||
@@ -117,21 +58,9 @@
|
||||
<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>
|
||||
@@ -255,9 +184,6 @@
|
||||
<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>
|
||||
@@ -357,15 +283,6 @@
|
||||
<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>
|
||||
@@ -420,15 +337,6 @@
|
||||
<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>
|
||||
@@ -447,4 +355,10 @@
|
||||
<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>
|
||||
<data name="net_security_sslprotocol_contiguous">
|
||||
<value>The requested combination of SslProtocols ({0}) is not valid for this platform because it skips intermediate versions.</value>
|
||||
</data>
|
||||
<data name="net_encryptionpolicy_notsupported" xml:space="preserve">
|
||||
<value>The '{0}' encryption policy is not supported on this platform.</value>
|
||||
</data>
|
||||
</root>
|
||||
|
||||
@@ -5,19 +5,22 @@
|
||||
<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>
|
||||
<PropertyGroup Condition=" '$(TargetsOSX)' == 'true' ">
|
||||
<DefineConstants>$(DefineConstants);SYSNETSECURITY_NO_OPENSSL</DefineConstants>
|
||||
</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'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-OSX-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-OSX-Release|AnyCPU'" />
|
||||
<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)' == 'uap-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Windows_NT-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="System\PinnableBufferCache.cs" />
|
||||
<Compile Include="System\Net\CertificateValidationPal.cs" />
|
||||
<Compile Include="System\Net\FixedSizeReader.cs" />
|
||||
<Compile Include="System\Net\HelperAsyncResults.cs" />
|
||||
<Compile Include="System\Net\SslStreamContext.cs" />
|
||||
@@ -49,19 +52,12 @@
|
||||
<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>
|
||||
@@ -73,9 +69,6 @@
|
||||
<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>
|
||||
@@ -98,9 +91,6 @@
|
||||
<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>
|
||||
@@ -123,7 +113,7 @@
|
||||
<Link>Common\System\Net\SecurityStatusPal.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(TargetsWindows)' == 'true' And '$(TargetGroup)' == 'netcoreapp' ">
|
||||
<ItemGroup Condition=" '$(TargetsWindows)' == 'true'">
|
||||
<Compile Include="System\Net\CertificateValidationPal.Windows.cs" />
|
||||
<Compile Include="System\Net\Security\NegotiateStreamPal.Windows.cs" />
|
||||
<Compile Include="System\Net\Security\NetEventSource.Security.Windows.cs" />
|
||||
@@ -222,11 +212,55 @@
|
||||
<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="$(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.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)\System\Net\ContextFlagsAdapterPal.Unix.cs">
|
||||
<Link>Common\System\Net\ContextFlagsAdapterPal.Unix.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\Net\Http\TlsCertificateExtensions.cs">
|
||||
<Link>Common\System\Net\Http\TlsCertificateExtensions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\Net\Security\NegotiateStreamPal.Unix.cs">
|
||||
<Link>Common\System\Net\Security\NegotiateStreamPal.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\SafeDeleteNegoContext.cs">
|
||||
<Link>Common\System\Net\Security\Unix\SafeDeleteNegoContext.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="System\Net\Security\NegotiateStreamPal.Unix.cs" />
|
||||
<Compile Include="System\Net\Security\Pal.Managed\EndpointChannelBindingToken.cs" />
|
||||
<Compile Include="System\Net\Security\Pal.Managed\SafeChannelBindingHandle.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(TargetsUnix)' == 'true' AND '$(TargetsOSX)' != 'true' ">
|
||||
<Compile Include="System\Net\CertificateValidationPal.Unix.cs" />
|
||||
<Compile Include="System\Net\Security\SslStreamPal.Unix.cs" />
|
||||
<Compile Include="System\Net\Security\SslConnectionInfo.Unix.cs" />
|
||||
@@ -234,21 +268,6 @@
|
||||
<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>
|
||||
@@ -282,9 +301,6 @@
|
||||
<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>
|
||||
@@ -297,21 +313,6 @@
|
||||
<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>
|
||||
@@ -330,37 +331,59 @@
|
||||
<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 Condition=" '$(TargetsOSX)' == 'true' ">
|
||||
<Compile Include="$(CommonPath)\Interop\OSX\Interop.CoreFoundation.cs">
|
||||
<Link>Common\Interop\OSX\Interop.CoreFoundation.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\OSX\Interop.CoreFoundation.CFArray.cs">
|
||||
<Link>Common\Interop\OSX\Interop.CoreFoundation.CFArray.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\OSX\Interop.CoreFoundation.CFData.cs">
|
||||
<Link>Common\Interop\OSX\Interop.CoreFoundation.CFData.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\OSX\Interop.CoreFoundation.CFDate.cs">
|
||||
<Link>Common\Interop\OSX\Interop.CoreFoundation.CFDate.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\OSX\Interop.CoreFoundation.CFError.cs">
|
||||
<Link>Common\Interop\OSX\Interop.CoreFoundation.CFError.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\OSX\Interop.CoreFoundation.CFString.cs">
|
||||
<Link>Common\Interop\OSX\Interop.CoreFoundation.CFString.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\OSX\Interop.Libraries.cs">
|
||||
<Link>Common\Interop\OSX\Interop.Libraries.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.SecErrMessage.cs">
|
||||
<Link>Common\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.SecErrMessage.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.SslErr.cs">
|
||||
<Link>Common\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.SslErr.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.Ssl.cs">
|
||||
<Link>Common\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.Ssl.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.X509Chain.cs">
|
||||
<Link>Common\Interop\OSX\System.Security.Cryptography.Native.Apple\Interop.X509Chain.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeCreateHandle.OSX.cs">
|
||||
<Link>Common\Microsoft\Win32\SafeHandles\SafeCreateHandle.OSX.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="System\Net\CertificateValidationPal.OSX.cs" />
|
||||
<Compile Include="System\Net\Security\Pal.OSX\SafeDeleteSslContext.cs" />
|
||||
<Compile Include="System\Net\Security\Pal.OSX\SafeFreeSslCredentials.cs" />
|
||||
<Compile Include="System\Net\Security\SslConnectionInfo.OSX.cs" />
|
||||
<Compile Include="System\Net\Security\SslStreamPal.OSX.cs" />
|
||||
<Compile Include="System\Net\Security\StreamSizes.OSX.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Win32.Primitives" />
|
||||
@@ -380,6 +403,7 @@
|
||||
<Reference Include="System.Security.Principal" />
|
||||
<Reference Include="System.Security.Principal.Windows" />
|
||||
<Reference Include="System.Threading" />
|
||||
<Reference Include="System.Threading.Tasks" />
|
||||
<Reference Include="System.Threading.ThreadPool" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetsUnix)' == 'true'">
|
||||
@@ -388,4 +412,4 @@
|
||||
<Reference Include="System.Security.Cryptography.Primitives" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
</Project>
|
||||
167
external/corefx/src/System.Net.Security/src/System/Net/CertificateValidationPal.OSX.cs
vendored
Normal file
167
external/corefx/src/System.Net.Security/src/System/Net/CertificateValidationPal.OSX.cs
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
// 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.Net.Security;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
internal static partial class CertificateValidationPal
|
||||
{
|
||||
internal static SslPolicyErrors VerifyCertificateProperties(
|
||||
SafeDeleteContext securityContext,
|
||||
X509Chain chain,
|
||||
X509Certificate2 remoteCertificate,
|
||||
bool checkCertName,
|
||||
bool isServer,
|
||||
string hostName)
|
||||
{
|
||||
SslPolicyErrors errors = SslPolicyErrors.None;
|
||||
|
||||
if (remoteCertificate == null)
|
||||
{
|
||||
errors |= SslPolicyErrors.RemoteCertificateNotAvailable;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!chain.Build(remoteCertificate))
|
||||
{
|
||||
errors |= SslPolicyErrors.RemoteCertificateChainErrors;
|
||||
}
|
||||
|
||||
if (!isServer && checkCertName)
|
||||
{
|
||||
SafeDeleteSslContext sslContext = (SafeDeleteSslContext)securityContext;
|
||||
|
||||
if (!Interop.AppleCrypto.SslCheckHostnameMatch(sslContext.SslContext, hostName, remoteCertificate.NotBefore))
|
||||
{
|
||||
errors |= SslPolicyErrors.RemoteCertificateNameMismatch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
//
|
||||
// Extracts a remote certificate upon request.
|
||||
//
|
||||
internal static X509Certificate2 GetRemoteCertificate(SafeDeleteContext securityContext)
|
||||
{
|
||||
return GetRemoteCertificate(securityContext, null);
|
||||
}
|
||||
|
||||
internal static X509Certificate2 GetRemoteCertificate(
|
||||
SafeDeleteContext securityContext,
|
||||
out X509Certificate2Collection remoteCertificateStore)
|
||||
{
|
||||
if (securityContext == null)
|
||||
{
|
||||
remoteCertificateStore = null;
|
||||
return null;
|
||||
}
|
||||
|
||||
remoteCertificateStore = new X509Certificate2Collection();
|
||||
return GetRemoteCertificate(securityContext, remoteCertificateStore);
|
||||
}
|
||||
|
||||
private static X509Certificate2 GetRemoteCertificate(
|
||||
SafeDeleteContext securityContext,
|
||||
X509Certificate2Collection remoteCertificateStore)
|
||||
{
|
||||
if (securityContext == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (NetEventSource.IsEnabled) NetEventSource.Enter(securityContext);
|
||||
|
||||
SafeSslHandle sslContext = ((SafeDeleteSslContext)securityContext).SslContext;
|
||||
|
||||
if (sslContext == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
X509Certificate2 result = null;
|
||||
|
||||
using (SafeX509ChainHandle chainHandle = Interop.AppleCrypto.SslCopyCertChain(sslContext))
|
||||
{
|
||||
long chainSize = Interop.AppleCrypto.X509ChainGetChainSize(chainHandle);
|
||||
|
||||
if (remoteCertificateStore != null)
|
||||
{
|
||||
for (int i = 0; i < chainSize; i++)
|
||||
{
|
||||
IntPtr certHandle = Interop.AppleCrypto.X509ChainGetCertificateAtIndex(chainHandle, i);
|
||||
remoteCertificateStore.Add(new X509Certificate2(certHandle));
|
||||
}
|
||||
}
|
||||
|
||||
// This will be a distinct object than remoteCertificateStore[0] (if applicable),
|
||||
// to match what the Windows and Unix PALs do.
|
||||
if (chainSize > 0)
|
||||
{
|
||||
IntPtr certHandle = Interop.AppleCrypto.X509ChainGetCertificateAtIndex(chainHandle, 0);
|
||||
result = new X509Certificate2(certHandle);
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
SafeSslHandle sslContext = ((SafeDeleteSslContext)securityContext).SslContext;
|
||||
|
||||
if (sslContext == null)
|
||||
{
|
||||
return Array.Empty<string>();
|
||||
}
|
||||
|
||||
using (SafeCFArrayHandle dnArray = Interop.AppleCrypto.SslCopyCADistinguishedNames(sslContext))
|
||||
{
|
||||
long size = Interop.CoreFoundation.CFArrayGetCount(dnArray);
|
||||
|
||||
if (size == 0)
|
||||
{
|
||||
return Array.Empty<string>();
|
||||
}
|
||||
|
||||
string[] distinguishedNames = new string[size];
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
IntPtr element = Interop.CoreFoundation.CFArrayGetValueAtIndex(dnArray, i);
|
||||
|
||||
using (SafeCFDataHandle cfData = new SafeCFDataHandle(element, ownsHandle: false))
|
||||
{
|
||||
byte[] dnData = Interop.CoreFoundation.CFGetData(cfData);
|
||||
X500DistinguishedName dn = new X500DistinguishedName(dnData);
|
||||
distinguishedNames[i] = dn.Name;
|
||||
}
|
||||
}
|
||||
|
||||
return distinguishedNames;
|
||||
}
|
||||
}
|
||||
|
||||
private static X509Store OpenStore(StoreLocation storeLocation)
|
||||
{
|
||||
X509Store store = new X509Store(StoreName.My, storeLocation);
|
||||
store.Open(OpenFlags.ReadOnly);
|
||||
return store;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,21 +3,16 @@
|
||||
// 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(
|
||||
SafeDeleteContext securityContext,
|
||||
X509Chain chain,
|
||||
X509Certificate2 remoteCertificate,
|
||||
bool checkCertName,
|
||||
@@ -30,9 +25,27 @@ namespace System.Net
|
||||
//
|
||||
// Extracts a remote certificate upon request.
|
||||
//
|
||||
internal static X509Certificate2 GetRemoteCertificate(SafeDeleteContext securityContext, out X509Certificate2Collection remoteCertificateStore)
|
||||
internal static X509Certificate2 GetRemoteCertificate(SafeDeleteContext securityContext)
|
||||
{
|
||||
return GetRemoteCertificate(securityContext, null);
|
||||
}
|
||||
|
||||
internal static X509Certificate2 GetRemoteCertificate(
|
||||
SafeDeleteContext securityContext,
|
||||
out X509Certificate2Collection remoteCertificateStore)
|
||||
{
|
||||
if (securityContext == null)
|
||||
{
|
||||
remoteCertificateStore = null;
|
||||
return null;
|
||||
}
|
||||
|
||||
remoteCertificateStore = new X509Certificate2Collection();
|
||||
return GetRemoteCertificate(securityContext, remoteCertificateStore);
|
||||
}
|
||||
|
||||
private static X509Certificate2 GetRemoteCertificate(SafeDeleteContext securityContext, X509Certificate2Collection remoteCertificateStore)
|
||||
{
|
||||
remoteCertificateStore = null;
|
||||
bool gotReference = false;
|
||||
|
||||
if (securityContext == null)
|
||||
@@ -54,24 +67,25 @@ namespace System.Net
|
||||
result = new X509Certificate2(remoteContext.DangerousGetHandle());
|
||||
}
|
||||
|
||||
remoteCertificateStore = new X509Certificate2Collection();
|
||||
|
||||
using (SafeSharedX509StackHandle chainStack =
|
||||
Interop.OpenSsl.GetPeerCertificateChain(((SafeDeleteSslContext)securityContext).SslContext))
|
||||
if (remoteCertificateStore != null)
|
||||
{
|
||||
if (!chainStack.IsInvalid)
|
||||
using (SafeSharedX509StackHandle chainStack =
|
||||
Interop.OpenSsl.GetPeerCertificateChain(((SafeDeleteSslContext)securityContext).SslContext))
|
||||
{
|
||||
int count = Interop.Crypto.GetX509StackFieldCount(chainStack);
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
if (!chainStack.IsInvalid)
|
||||
{
|
||||
IntPtr certPtr = Interop.Crypto.GetX509StackField(chainStack, i);
|
||||
int count = Interop.Crypto.GetX509StackFieldCount(chainStack);
|
||||
|
||||
if (certPtr != IntPtr.Zero)
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
// X509Certificate2(IntPtr) calls X509_dup, so the reference is appropriately tracked.
|
||||
X509Certificate2 chainCert = new X509Certificate2(certPtr);
|
||||
remoteCertificateStore.Add(chainCert);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,49 +146,22 @@ namespace System.Net
|
||||
}
|
||||
}
|
||||
|
||||
internal static X509Store EnsureStoreOpened(bool isMachineStore)
|
||||
static partial void CheckSupportsStore(StoreLocation storeLocation, ref bool hasSupport)
|
||||
{
|
||||
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);
|
||||
// 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.
|
||||
if (storeLocation == StoreLocation.LocalMachine)
|
||||
hasSupport = false;
|
||||
}
|
||||
|
||||
private static X509Store EnsureStoreOpened(ref X509Store storeField, StoreLocation storeLocation)
|
||||
private static X509Store OpenStore(StoreLocation storeLocation)
|
||||
{
|
||||
X509Store store = Volatile.Read(ref storeField);
|
||||
Debug.Assert(storeLocation == StoreLocation.CurrentUser);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
X509Store store = new X509Store(StoreName.My, storeLocation);
|
||||
store.Open(OpenFlags.ReadOnly);
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
@@ -3,25 +3,18 @@
|
||||
// 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(
|
||||
SafeDeleteContext securityContext,
|
||||
X509Chain chain,
|
||||
X509Certificate2 remoteCertificate,
|
||||
bool checkCertName,
|
||||
@@ -44,7 +37,7 @@ namespace System.Net
|
||||
|
||||
var eppStruct = new Interop.Crypt32.SSL_EXTRA_CERT_CHAIN_POLICY_PARA()
|
||||
{
|
||||
cbSize = (uint)Marshal.SizeOf<Interop.Crypt32.SSL_EXTRA_CERT_CHAIN_POLICY_PARA>(),
|
||||
cbSize = (uint)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
|
||||
@@ -52,7 +45,7 @@ namespace System.Net
|
||||
|
||||
var cppStruct = new Interop.Crypt32.CERT_CHAIN_POLICY_PARA()
|
||||
{
|
||||
cbSize = (uint)Marshal.SizeOf<Interop.Crypt32.CERT_CHAIN_POLICY_PARA>(),
|
||||
cbSize = (uint)sizeof(Interop.Crypt32.CERT_CHAIN_POLICY_PARA),
|
||||
dwFlags = 0,
|
||||
pvExtraPolicyPara = &eppStruct
|
||||
};
|
||||
@@ -186,72 +179,32 @@ namespace System.Net
|
||||
//
|
||||
// Security: We temporarily reset thread token to open the cert store under process account.
|
||||
//
|
||||
internal static X509Store EnsureStoreOpened(bool isMachineStore)
|
||||
internal static X509Store OpenStore(StoreLocation storeLocation)
|
||||
{
|
||||
X509Store store = isMachineStore ? s_myMachineCertStoreEx : s_myCertStoreEx;
|
||||
X509Store store = new X509Store(StoreName.My, storeLocation);
|
||||
|
||||
// TODO #3862 Investigate if this can be switched to either the static or Lazy<T> patterns.
|
||||
if (store == null)
|
||||
// For app-compat We want to ensure the store is opened under the **process** account.
|
||||
try
|
||||
{
|
||||
lock (s_syncObject)
|
||||
WindowsIdentity.RunImpersonated(SafeAccessTokenHandle.InvalidHandle, () =>
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
|
||||
});
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
private static uint Verify(SafeX509ChainHandle chainContext, ref Interop.Crypt32.CERT_CHAIN_POLICY_PARA cpp)
|
||||
private static unsafe 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>();
|
||||
status.cbSize = (uint)sizeof(Interop.Crypt32.CERT_CHAIN_POLICY_STATUS);
|
||||
|
||||
bool errorCode =
|
||||
Interop.Crypt32.CertVerifyCertificateChainPolicy(
|
||||
|
||||
85
external/corefx/src/System.Net.Security/src/System/Net/CertificateValidationPal.cs
vendored
Normal file
85
external/corefx/src/System.Net.Security/src/System/Net/CertificateValidationPal.cs
vendored
Normal 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.Security;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
|
||||
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;
|
||||
|
||||
static partial void CheckSupportsStore(StoreLocation storeLocation, ref bool hasSupport);
|
||||
|
||||
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)
|
||||
{
|
||||
StoreLocation storeLocation = isMachineStore ? StoreLocation.LocalMachine : StoreLocation.CurrentUser;
|
||||
|
||||
// On Windows and OSX CheckSupportsStore is not defined, so the call is eliminated and the
|
||||
// if should be folded out.
|
||||
//
|
||||
// On Unix it will prevent the lock from being held and released over and over for the LocalMachine store.
|
||||
bool supportsStore = true;
|
||||
CheckSupportsStore(storeLocation, ref supportsStore);
|
||||
|
||||
if (!supportsStore)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
lock (s_syncObject)
|
||||
{
|
||||
store = isMachineStore ? s_myMachineCertStoreEx : s_myCertStoreEx;
|
||||
|
||||
if (store == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 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.
|
||||
store = OpenStore(storeLocation);
|
||||
|
||||
if (NetEventSource.IsEnabled)
|
||||
NetEventSource.Info(null, $"storeLocation: {storeLocation} returned store {store}");
|
||||
|
||||
if (isMachineStore)
|
||||
{
|
||||
s_myMachineCertStoreEx = store;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_myCertStoreEx = 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,41 +4,29 @@
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading;
|
||||
|
||||
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
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
internal static 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)
|
||||
/// <summary>
|
||||
/// Returns 0 on legitimate EOF or if 0 bytes were requested, otherwise reads as directed or throws.
|
||||
/// Returns count on success.
|
||||
/// </summary>
|
||||
public static int ReadPacket(Stream transport, byte[] buffer, int offset, int count)
|
||||
{
|
||||
_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;
|
||||
int remainingCount = count;
|
||||
do
|
||||
{
|
||||
int bytes = _transport.Read(buffer, offset, tempCount);
|
||||
|
||||
int bytes = transport.Read(buffer, offset, remainingCount);
|
||||
if (bytes == 0)
|
||||
{
|
||||
if (tempCount != count)
|
||||
if (remainingCount != count)
|
||||
{
|
||||
throw new IOException(SR.net_io_eof);
|
||||
}
|
||||
@@ -46,121 +34,45 @@ namespace System.Net
|
||||
return 0;
|
||||
}
|
||||
|
||||
tempCount -= bytes;
|
||||
remainingCount -= bytes;
|
||||
offset += bytes;
|
||||
} while (tempCount != 0);
|
||||
} while (remainingCount > 0);
|
||||
|
||||
Debug.Assert(remainingCount == 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)
|
||||
/// <summary>
|
||||
/// Completes "request" with 0 if 0 bytes was requested or legitimate EOF received.
|
||||
/// Otherwise, reads as directed or completes "request" with an Exception.
|
||||
/// </summary>
|
||||
public static async void ReadPacketAsync(Stream transport, AsyncProtocolRequest request) // "async Task" might result in additional, unnecessary allocation
|
||||
{
|
||||
_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))
|
||||
int remainingCount = request.Count, offset = request.Offset;
|
||||
do
|
||||
{
|
||||
return;
|
||||
}
|
||||
int bytes = await transport.ReadAsync(request.Buffer, offset, remainingCount, CancellationToken.None).ConfigureAwait(false);
|
||||
if (bytes == 0)
|
||||
{
|
||||
if (remainingCount != request.Count)
|
||||
{
|
||||
throw new IOException(SR.net_io_eof);
|
||||
}
|
||||
request.CompleteRequest(0);
|
||||
return;
|
||||
}
|
||||
|
||||
reader.StartReading();
|
||||
offset += bytes;
|
||||
remainingCount -= bytes;
|
||||
} while (remainingCount > 0);
|
||||
|
||||
Debug.Assert(remainingCount == 0);
|
||||
request.CompleteRequest(request.Count);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (request.IsUserCompleted)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
request.CompleteUserWithError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,9 @@ namespace System.Net.Security
|
||||
private int _InternalOffset;
|
||||
private int _InternalBufferCount;
|
||||
|
||||
private FixedSizeReader _FrameReader;
|
||||
|
||||
private void InitializeStreamPart()
|
||||
{
|
||||
_ReadHeader = new byte[4];
|
||||
_FrameReader = new FixedSizeReader(InnerStream);
|
||||
}
|
||||
|
||||
private byte[] InternalBuffer
|
||||
@@ -267,7 +264,7 @@ namespace System.Net.Security
|
||||
if (asyncRequest != null)
|
||||
{
|
||||
asyncRequest.SetNextRequest(_ReadHeader, 0, _ReadHeader.Length, s_readCallback);
|
||||
_FrameReader.AsyncReadPacket(asyncRequest);
|
||||
FixedSizeReader.ReadPacketAsync(InnerStream, asyncRequest);
|
||||
if (!asyncRequest.MustCompleteSynchronously)
|
||||
{
|
||||
return 0;
|
||||
@@ -277,7 +274,7 @@ namespace System.Net.Security
|
||||
}
|
||||
else
|
||||
{
|
||||
readBytes = _FrameReader.ReadPacket(_ReadHeader, 0, _ReadHeader.Length);
|
||||
readBytes = FixedSizeReader.ReadPacket(InnerStream, _ReadHeader, 0, _ReadHeader.Length);
|
||||
}
|
||||
|
||||
return StartFrameBody(readBytes, buffer, offset, count, asyncRequest);
|
||||
@@ -321,7 +318,7 @@ namespace System.Net.Security
|
||||
{
|
||||
asyncRequest.SetNextRequest(InternalBuffer, 0, readBytes, s_readCallback);
|
||||
|
||||
_FrameReader.AsyncReadPacket(asyncRequest);
|
||||
FixedSizeReader.ReadPacketAsync(InnerStream, asyncRequest);
|
||||
|
||||
if (!asyncRequest.MustCompleteSynchronously)
|
||||
{
|
||||
@@ -332,7 +329,7 @@ namespace System.Net.Security
|
||||
}
|
||||
else //Sync
|
||||
{
|
||||
readBytes = _FrameReader.ReadPacket(InternalBuffer, 0, readBytes);
|
||||
readBytes = FixedSizeReader.ReadPacket(InnerStream, InternalBuffer, 0, readBytes);
|
||||
}
|
||||
|
||||
return ProcessFrameBody(readBytes, buffer, offset, count, asyncRequest);
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Security;
|
||||
using System.Security.Principal;
|
||||
using System.Threading;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Security.Authentication;
|
||||
using System.Security.Authentication.ExtendedProtection;
|
||||
|
||||
@@ -112,7 +113,7 @@ namespace System.Net.Security
|
||||
{
|
||||
if (_exception != null && !_canRetryAuthentication)
|
||||
{
|
||||
throw _exception;
|
||||
ExceptionDispatchInfo.Capture(_exception).Throw();
|
||||
}
|
||||
|
||||
if (_context != null && _context.IsValidContext)
|
||||
@@ -313,7 +314,7 @@ namespace System.Net.Security
|
||||
{
|
||||
if (_exception != null)
|
||||
{
|
||||
throw _exception;
|
||||
ExceptionDispatchInfo.Capture(_exception).Throw();
|
||||
}
|
||||
|
||||
if (authSucessCheck && !IsAuthenticated)
|
||||
@@ -398,7 +399,7 @@ namespace System.Net.Security
|
||||
{
|
||||
// Round-trip it through the SetException().
|
||||
e = SetException(e);
|
||||
throw e;
|
||||
ExceptionDispatchInfo.Capture(e).Throw();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -689,7 +690,7 @@ namespace System.Net.Security
|
||||
}
|
||||
|
||||
_canRetryAuthentication = true;
|
||||
throw exception;
|
||||
ExceptionDispatchInfo.Capture(exception).Throw();
|
||||
}
|
||||
|
||||
private static void WriteCallback(IAsyncResult transportResult)
|
||||
@@ -713,10 +714,10 @@ namespace System.Net.Security
|
||||
authState._framer.EndWriteMessage(transportResult);
|
||||
|
||||
// Special case for an error notification.
|
||||
if (lazyResult.Result is Exception)
|
||||
if (lazyResult.Result is Exception e)
|
||||
{
|
||||
authState._canRetryAuthentication = true;
|
||||
throw (Exception)lazyResult.Result;
|
||||
ExceptionDispatchInfo.Capture(e).Throw();
|
||||
}
|
||||
|
||||
authState.CheckCompletionBeforeNextReceive(lazyResult);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using System.Security.Authentication.ExtendedProtection;
|
||||
using System.Security.Principal;
|
||||
|
||||
@@ -620,14 +621,14 @@ namespace System.Net.Security
|
||||
// No "artificial" timeouts implemented so far, InnerStream controls timeout.
|
||||
bufferResult.InternalWaitForCompletion();
|
||||
|
||||
if (bufferResult.Result is Exception)
|
||||
if (bufferResult.Result is Exception e)
|
||||
{
|
||||
if (bufferResult.Result is IOException)
|
||||
if (e is IOException)
|
||||
{
|
||||
throw (Exception)bufferResult.Result;
|
||||
ExceptionDispatchInfo.Capture(e).Throw();
|
||||
}
|
||||
|
||||
throw new IOException(SR.net_io_read, (Exception)bufferResult.Result);
|
||||
throw new IOException(SR.net_io_read, e);
|
||||
}
|
||||
|
||||
return bufferResult.Int32Result;
|
||||
@@ -693,14 +694,14 @@ namespace System.Net.Security
|
||||
// No "artificial" timeouts implemented so far, InnerStream controls timeout.
|
||||
bufferResult.InternalWaitForCompletion();
|
||||
|
||||
if (bufferResult.Result is Exception)
|
||||
if (bufferResult.Result is Exception e)
|
||||
{
|
||||
if (bufferResult.Result is IOException)
|
||||
if (e is IOException)
|
||||
{
|
||||
throw (Exception)bufferResult.Result;
|
||||
ExceptionDispatchInfo.Capture(e).Throw();
|
||||
}
|
||||
|
||||
throw new IOException(SR.net_io_write, (Exception)bufferResult.Result);
|
||||
throw new IOException(SR.net_io_write, e);
|
||||
}
|
||||
#if DEBUG
|
||||
}
|
||||
|
||||
@@ -330,5 +330,46 @@ namespace System.Net
|
||||
result = cert.ToString(fVerbose: true);
|
||||
}
|
||||
}
|
||||
|
||||
[NonEvent]
|
||||
private unsafe void WriteEvent(int eventId, string arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8)
|
||||
{
|
||||
if (IsEnabled())
|
||||
{
|
||||
if (arg1 == null) arg1 = "";
|
||||
|
||||
fixed (char* arg1Ptr = arg1)
|
||||
{
|
||||
const int NumEventDatas = 8;
|
||||
var descrs = stackalloc EventData[NumEventDatas];
|
||||
|
||||
descrs[0].DataPointer = (IntPtr)(arg1Ptr);
|
||||
descrs[0].Size = (arg1.Length + 1) * sizeof(char);
|
||||
|
||||
descrs[1].DataPointer = (IntPtr)(&arg2);
|
||||
descrs[1].Size = sizeof(int);
|
||||
|
||||
descrs[2].DataPointer = (IntPtr)(&arg3);
|
||||
descrs[2].Size = sizeof(int);
|
||||
|
||||
descrs[3].DataPointer = (IntPtr)(&arg4);
|
||||
descrs[3].Size = sizeof(int);
|
||||
|
||||
descrs[4].DataPointer = (IntPtr)(&arg5);
|
||||
descrs[4].Size = sizeof(int);
|
||||
|
||||
descrs[5].DataPointer = (IntPtr)(&arg6);
|
||||
descrs[5].Size = sizeof(int);
|
||||
|
||||
descrs[6].DataPointer = (IntPtr)(&arg7);
|
||||
descrs[6].Size = sizeof(int);
|
||||
|
||||
descrs[7].DataPointer = (IntPtr)(&arg8);
|
||||
descrs[7].Size = sizeof(int);
|
||||
|
||||
WriteEventCore(eventId, NumEventDatas, descrs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
// 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.Security.Authentication.ExtendedProtection;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
|
||||
namespace System.Net.Security
|
||||
{
|
||||
internal static class EndpointChannelBindingToken
|
||||
{
|
||||
internal static ChannelBinding Build(SafeDeleteContext securityContext)
|
||||
{
|
||||
using (X509Certificate2 cert = CertificateValidationPal.GetRemoteCertificate(securityContext))
|
||||
{
|
||||
if (cert == null)
|
||||
return null;
|
||||
|
||||
SafeChannelBindingHandle bindingHandle = new SafeChannelBindingHandle(ChannelBindingKind.Unique);
|
||||
|
||||
using (HashAlgorithm hashAlgo = GetHashForChannelBinding(cert))
|
||||
{
|
||||
byte[] bindingHash = hashAlgo.ComputeHash(cert.RawData);
|
||||
bindingHandle.SetCertHash(bindingHash);
|
||||
}
|
||||
|
||||
return bindingHandle;
|
||||
}
|
||||
}
|
||||
|
||||
private static HashAlgorithm GetHashForChannelBinding(X509Certificate2 cert)
|
||||
{
|
||||
Oid signatureAlgorithm = cert.SignatureAlgorithm;
|
||||
switch (signatureAlgorithm.Value)
|
||||
{
|
||||
// RFC 5929 4.1 says that MD5 and SHA1 both upgrade to SHA256 for cbt calculation
|
||||
case "1.2.840.113549.2.5": // MD5
|
||||
case "1.2.840.113549.1.1.4": // MD5RSA
|
||||
case "1.3.14.3.2.26": // SHA1
|
||||
case "1.2.840.10040.4.3": // SHA1DSA
|
||||
case "1.2.840.10045.4.1": // SHA1ECDSA
|
||||
case "1.2.840.113549.1.1.5": // SHA1RSA
|
||||
case "2.16.840.1.101.3.4.2.1": // SHA256
|
||||
case "1.2.840.10045.4.3.2": // SHA256ECDSA
|
||||
case "1.2.840.113549.1.1.11": // SHA256RSA
|
||||
return SHA256.Create();
|
||||
|
||||
case "2.16.840.1.101.3.4.2.2": // SHA384
|
||||
case "1.2.840.10045.4.3.3": // SHA384ECDSA
|
||||
case "1.2.840.113549.1.1.12": // SHA384RSA
|
||||
return SHA384.Create();
|
||||
|
||||
case "2.16.840.1.101.3.4.2.3": // SHA512
|
||||
case "1.2.840.10045.4.3.4": // SHA512ECDSA
|
||||
case "1.2.840.113549.1.1.13": // SHA512RSA
|
||||
return SHA512.Create();
|
||||
|
||||
default:
|
||||
throw new ArgumentException(signatureAlgorithm.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
// 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.Runtime.InteropServices;
|
||||
using System.Security.Authentication.ExtendedProtection;
|
||||
using System.Text;
|
||||
|
||||
namespace System.Net.Security
|
||||
{
|
||||
internal sealed class SafeChannelBindingHandle : ChannelBinding
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct SecChannelBindings
|
||||
{
|
||||
internal int InitiatorLength;
|
||||
internal int InitiatorOffset;
|
||||
internal int AcceptorAddrType;
|
||||
internal int AcceptorLength;
|
||||
internal int AcceptorOffset;
|
||||
internal int ApplicationDataLength;
|
||||
internal int ApplicationDataOffset;
|
||||
}
|
||||
|
||||
private const int CertHashMaxSize = 128;
|
||||
private static readonly byte[] s_tlsServerEndPointByteArray = Encoding.UTF8.GetBytes("tls-server-end-point:");
|
||||
private static readonly byte[] s_tlsUniqueByteArray = Encoding.UTF8.GetBytes("tls-unique:");
|
||||
private static readonly int s_secChannelBindingSize = Marshal.SizeOf<SecChannelBindings>();
|
||||
|
||||
private readonly int _cbtPrefixByteArraySize;
|
||||
internal int Length { get; private set; }
|
||||
internal IntPtr CertHashPtr { get; }
|
||||
public override int Size => Length;
|
||||
|
||||
internal void SetCertHash(byte[] certHashBytes)
|
||||
{
|
||||
Debug.Assert(certHashBytes != null, "check certHashBytes is not null");
|
||||
Debug.Assert(certHashBytes.Length <= CertHashMaxSize);
|
||||
|
||||
int length = certHashBytes.Length;
|
||||
Marshal.Copy(certHashBytes, 0, CertHashPtr, length);
|
||||
SetCertHashLength(length);
|
||||
}
|
||||
|
||||
private byte[] GetPrefixBytes(ChannelBindingKind kind)
|
||||
{
|
||||
Debug.Assert(kind == ChannelBindingKind.Endpoint || kind == ChannelBindingKind.Unique);
|
||||
return kind == ChannelBindingKind.Endpoint
|
||||
? s_tlsServerEndPointByteArray
|
||||
: s_tlsUniqueByteArray;
|
||||
}
|
||||
|
||||
internal SafeChannelBindingHandle(ChannelBindingKind kind)
|
||||
{
|
||||
byte[] cbtPrefix = GetPrefixBytes(kind);
|
||||
_cbtPrefixByteArraySize = cbtPrefix.Length;
|
||||
handle = Marshal.AllocHGlobal(s_secChannelBindingSize + _cbtPrefixByteArraySize + CertHashMaxSize);
|
||||
IntPtr cbtPrefixPtr = handle + s_secChannelBindingSize;
|
||||
Marshal.Copy(cbtPrefix, 0, cbtPrefixPtr, _cbtPrefixByteArraySize);
|
||||
CertHashPtr = cbtPrefixPtr + _cbtPrefixByteArraySize;
|
||||
Length = CertHashMaxSize;
|
||||
}
|
||||
|
||||
internal void SetCertHashLength(int certHashLength)
|
||||
{
|
||||
int cbtLength = _cbtPrefixByteArraySize + certHashLength;
|
||||
Length = s_secChannelBindingSize + cbtLength;
|
||||
|
||||
SecChannelBindings channelBindings = new SecChannelBindings()
|
||||
{
|
||||
ApplicationDataLength = cbtLength,
|
||||
ApplicationDataOffset = s_secChannelBindingSize
|
||||
};
|
||||
Marshal.StructureToPtr(channelBindings, handle, true);
|
||||
}
|
||||
|
||||
public override bool IsInvalid => handle == IntPtr.Zero;
|
||||
|
||||
protected override bool ReleaseHandle()
|
||||
{
|
||||
Marshal.FreeHGlobal(handle);
|
||||
SetHandle(IntPtr.Zero);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
348
external/corefx/src/System.Net.Security/src/System/Net/Security/Pal.OSX/SafeDeleteSslContext.cs
vendored
Normal file
348
external/corefx/src/System.Net.Security/src/System/Net/Security/Pal.OSX/SafeDeleteSslContext.cs
vendored
Normal file
@@ -0,0 +1,348 @@
|
||||
// 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.Diagnostics;
|
||||
using System.Net.Http;
|
||||
using System.Net.Security;
|
||||
using System.Security.Authentication;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
internal sealed class SafeDeleteSslContext : SafeDeleteContext
|
||||
{
|
||||
private SafeSslHandle _sslContext;
|
||||
private Interop.AppleCrypto.SSLReadFunc _readCallback;
|
||||
private Interop.AppleCrypto.SSLWriteFunc _writeCallback;
|
||||
private Queue<byte> _fromConnection = new Queue<byte>();
|
||||
private Queue<byte> _toConnection = new Queue<byte>();
|
||||
|
||||
public SafeSslHandle SslContext => _sslContext;
|
||||
|
||||
public SafeDeleteSslContext(SafeFreeSslCredentials credential, bool isServer)
|
||||
: base(credential)
|
||||
{
|
||||
Debug.Assert((null != credential) && !credential.IsInvalid, "Invalid credential used in SafeDeleteSslContext");
|
||||
|
||||
try
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
_readCallback = ReadFromConnection;
|
||||
_writeCallback = WriteToConnection;
|
||||
}
|
||||
|
||||
_sslContext = CreateSslContext(credential, isServer);
|
||||
|
||||
int osStatus = Interop.AppleCrypto.SslSetIoCallbacks(
|
||||
_sslContext,
|
||||
_readCallback,
|
||||
_writeCallback);
|
||||
|
||||
if (osStatus != 0)
|
||||
{
|
||||
throw Interop.AppleCrypto.CreateExceptionForOSStatus(osStatus);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.Write("Exception Caught. - " + ex);
|
||||
Dispose();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private static SafeSslHandle CreateSslContext(SafeFreeSslCredentials credential, bool isServer)
|
||||
{
|
||||
switch (credential.Policy)
|
||||
{
|
||||
case EncryptionPolicy.RequireEncryption:
|
||||
case EncryptionPolicy.AllowNoEncryption:
|
||||
// SecureTransport doesn't allow TLS_NULL_NULL_WITH_NULL, but
|
||||
// since AllowNoEncryption intersect OS-supported isn't nothing,
|
||||
// let it pass.
|
||||
break;
|
||||
default:
|
||||
throw new PlatformNotSupportedException(SR.net_encryptionpolicy_notsupported);
|
||||
}
|
||||
|
||||
SafeSslHandle sslContext = Interop.AppleCrypto.SslCreateContext(isServer ? 1 : 0);
|
||||
|
||||
try
|
||||
{
|
||||
if (sslContext.IsInvalid)
|
||||
{
|
||||
// This is as likely as anything. No error conditions are defined for
|
||||
// the OS function, and our shim only adds a NULL if isServer isn't a normalized bool.
|
||||
throw new OutOfMemoryException();
|
||||
}
|
||||
|
||||
// Let None mean "system default"
|
||||
if (credential.Protocols != SslProtocols.None)
|
||||
{
|
||||
SetProtocols(sslContext, credential.Protocols);
|
||||
}
|
||||
|
||||
if (credential.Certificate != null)
|
||||
{
|
||||
SetCertificate(sslContext, credential.Certificate);
|
||||
}
|
||||
|
||||
Interop.AppleCrypto.SslBreakOnServerAuth(sslContext, true);
|
||||
Interop.AppleCrypto.SslBreakOnClientAuth(sslContext, true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
sslContext.Dispose();
|
||||
throw;
|
||||
}
|
||||
|
||||
return sslContext;
|
||||
}
|
||||
|
||||
public override bool IsInvalid => _sslContext?.IsInvalid ?? true;
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (null != _sslContext)
|
||||
{
|
||||
_sslContext.Dispose();
|
||||
_sslContext = null;
|
||||
}
|
||||
|
||||
_toConnection = null;
|
||||
_fromConnection = null;
|
||||
_writeCallback = null;
|
||||
_readCallback = null;
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
private unsafe int WriteToConnection(void* connection, byte* data, void** dataLength)
|
||||
{
|
||||
ulong toWrite = (ulong)*dataLength;
|
||||
byte* readFrom = data;
|
||||
|
||||
lock (_toConnection)
|
||||
{
|
||||
while (toWrite > 0)
|
||||
{
|
||||
_toConnection.Enqueue(*readFrom);
|
||||
readFrom++;
|
||||
toWrite--;
|
||||
}
|
||||
}
|
||||
|
||||
// Since we can enqueue everything, no need to re-assign *dataLength.
|
||||
const int noErr = 0;
|
||||
return noErr;
|
||||
}
|
||||
|
||||
private unsafe int ReadFromConnection(void* connection, byte* data, void** dataLength)
|
||||
{
|
||||
const int noErr = 0;
|
||||
const int errSSLWouldBlock = -9803;
|
||||
|
||||
ulong toRead = (ulong)*dataLength;
|
||||
|
||||
if (toRead == 0)
|
||||
{
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
uint transferred = 0;
|
||||
|
||||
lock (_fromConnection)
|
||||
{
|
||||
|
||||
if (_fromConnection.Count == 0)
|
||||
{
|
||||
|
||||
*dataLength = (void*)0;
|
||||
return errSSLWouldBlock;
|
||||
}
|
||||
|
||||
byte* writePos = data;
|
||||
|
||||
while (transferred < toRead && _fromConnection.Count > 0)
|
||||
{
|
||||
*writePos = _fromConnection.Dequeue();
|
||||
writePos++;
|
||||
transferred++;
|
||||
}
|
||||
}
|
||||
|
||||
*dataLength = (void*)transferred;
|
||||
return noErr;
|
||||
}
|
||||
|
||||
internal void Write(byte[] buf, int offset, int count)
|
||||
{
|
||||
Debug.Assert(buf != null);
|
||||
Debug.Assert(offset >= 0);
|
||||
Debug.Assert(count >= 0);
|
||||
Debug.Assert(count <= buf.Length - offset);
|
||||
|
||||
|
||||
lock (_fromConnection)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
_fromConnection.Enqueue(buf[offset + i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal int BytesReadyForConnection => _toConnection.Count;
|
||||
|
||||
internal byte[] ReadPendingWrites()
|
||||
{
|
||||
lock (_toConnection)
|
||||
{
|
||||
if (_toConnection.Count == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
byte[] data = _toConnection.ToArray();
|
||||
_toConnection.Clear();
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
internal int ReadPendingWrites(byte[] buf, int offset, int count)
|
||||
{
|
||||
Debug.Assert(buf != null);
|
||||
Debug.Assert(offset >= 0);
|
||||
Debug.Assert(count >= 0);
|
||||
Debug.Assert(count <= buf.Length - offset);
|
||||
|
||||
lock (_toConnection)
|
||||
{
|
||||
int limit = Math.Min(count, _toConnection.Count);
|
||||
|
||||
for (int i = 0; i < limit; i++)
|
||||
{
|
||||
buf[offset + i] = _toConnection.Dequeue();
|
||||
}
|
||||
|
||||
return limit;
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetProtocols(SafeSslHandle sslContext, SslProtocols protocols)
|
||||
{
|
||||
const SslProtocols SupportedProtocols = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12;
|
||||
SslProtocols minProtocolId;
|
||||
SslProtocols maxProtocolId;
|
||||
|
||||
switch (protocols & SupportedProtocols)
|
||||
{
|
||||
case SslProtocols.None:
|
||||
throw new PlatformNotSupportedException(SR.net_securityprotocolnotsupported);
|
||||
case SslProtocols.Tls:
|
||||
minProtocolId = SslProtocols.Tls;
|
||||
maxProtocolId = SslProtocols.Tls;
|
||||
break;
|
||||
case SslProtocols.Tls11:
|
||||
minProtocolId = SslProtocols.Tls11;
|
||||
maxProtocolId = SslProtocols.Tls11;
|
||||
break;
|
||||
case SslProtocols.Tls12:
|
||||
minProtocolId = SslProtocols.Tls12;
|
||||
maxProtocolId = SslProtocols.Tls12;
|
||||
break;
|
||||
case SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12:
|
||||
minProtocolId = SslProtocols.Tls;
|
||||
maxProtocolId = SslProtocols.Tls12;
|
||||
break;
|
||||
case SslProtocols.Tls11 | SslProtocols.Tls12:
|
||||
minProtocolId = SslProtocols.Tls11;
|
||||
maxProtocolId = SslProtocols.Tls12;
|
||||
break;
|
||||
case SslProtocols.Tls | SslProtocols.Tls11:
|
||||
minProtocolId = SslProtocols.Tls;
|
||||
maxProtocolId = SslProtocols.Tls11;
|
||||
break;
|
||||
default:
|
||||
throw new PlatformNotSupportedException(SR.net_security_sslprotocol_contiguous);
|
||||
}
|
||||
|
||||
Interop.AppleCrypto.SslSetMinProtocolVersion(sslContext, minProtocolId);
|
||||
Interop.AppleCrypto.SslSetMaxProtocolVersion(sslContext, maxProtocolId);
|
||||
}
|
||||
|
||||
private static void SetCertificate(SafeSslHandle sslContext, X509Certificate2 certificate)
|
||||
{
|
||||
Debug.Assert(sslContext != null, "sslContext != null");
|
||||
Debug.Assert(certificate != null, "certificate != null");
|
||||
Debug.Assert(certificate.HasPrivateKey, "certificate.HasPrivateKey");
|
||||
|
||||
X509Chain chain = TLSCertificateExtensions.BuildNewChain(
|
||||
certificate,
|
||||
includeClientApplicationPolicy: false);
|
||||
|
||||
using (chain)
|
||||
{
|
||||
X509ChainElementCollection elements = chain.ChainElements;
|
||||
|
||||
// We need to leave off the EE (first) and root (last) certificate from the intermediates.
|
||||
X509Certificate2[] intermediateCerts = elements.Count < 3
|
||||
? Array.Empty<X509Certificate2>()
|
||||
: new X509Certificate2[elements.Count - 2];
|
||||
|
||||
// Build an array which is [
|
||||
// SecIdentityRef for EE cert,
|
||||
// SecCertificateRef for intermed0,
|
||||
// SecCertificateREf for intermed1,
|
||||
// ...
|
||||
// ]
|
||||
IntPtr[] ptrs = new IntPtr[intermediateCerts.Length + 1];
|
||||
|
||||
for (int i = 0; i < intermediateCerts.Length; i++)
|
||||
{
|
||||
X509Certificate2 intermediateCert = elements[i + 1].Certificate;
|
||||
|
||||
if (intermediateCert.HasPrivateKey)
|
||||
{
|
||||
// In the unlikely event that we get a certificate with a private key from
|
||||
// a chain, clear it to the certificate.
|
||||
//
|
||||
// The current value of intermediateCert is still in elements, which will
|
||||
// get Disposed at the end of this method. The new value will be
|
||||
// in the intermediate certs array, which also gets serially Disposed.
|
||||
intermediateCert = new X509Certificate2(intermediateCert.RawData);
|
||||
}
|
||||
|
||||
intermediateCerts[i] = intermediateCert;
|
||||
ptrs[i + 1] = intermediateCert.Handle;
|
||||
}
|
||||
|
||||
ptrs[0] = certificate.Handle;
|
||||
|
||||
Interop.AppleCrypto.SslSetCertificate(sslContext, ptrs);
|
||||
|
||||
// The X509Chain created all new certs for us, so Dispose them.
|
||||
// And since the intermediateCerts could have been new instances, Dispose them, too
|
||||
for (int i = 0; i < elements.Count; i++)
|
||||
{
|
||||
elements[i].Certificate.Dispose();
|
||||
|
||||
if (i < intermediateCerts.Length)
|
||||
{
|
||||
intermediateCerts[i].Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user