Imported Upstream version 5.0.0.42

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

View File

@@ -0,0 +1,141 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.22911.2
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Security.Cryptography.Encoding.Tests", "tests\System.Security.Cryptography.Encoding.Tests.csproj", "{0581E9FA-D639-4B88-96D8-D092760F90B0}"
ProjectSection(ProjectDependencies) = postProject
{AA81E343-5E54-40B0-9381-C459419BE780} = {AA81E343-5E54-40B0-9381-C459419BE780}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Security.Cryptography.Encoding", "src\System.Security.Cryptography.Encoding.csproj", "{AA81E343-5E54-40B0-9381-C459419BE780}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
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
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
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-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
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
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{0581E9FA-D639-4B88-96D8-D092760F90B0}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = net463-Windows_NT-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = net463-Windows_NT-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = net463-Windows_NT-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = net463-Windows_NT-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = net463-Windows_NT-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = net463-Windows_NT-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = net463-Windows_NT-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = net463-Windows_NT-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = net463-Windows_NT-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = net463-Windows_NT-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = net463-Windows_NT-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = net463-Windows_NT-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = net463-Windows_NT-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = net463-Windows_NT-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = net463-Windows_NT-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnet463-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = net463-Windows_NT-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Unix-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Unix-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Unix-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnetcoreapp-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Unix-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Unix|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.DebugNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
{AA81E343-5E54-40B0-9381-C459419BE780}.ReleaseNETCoreAppnetcoreapp-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

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

View File

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

View File

@@ -0,0 +1,127 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// ------------------------------------------------------------------------------
// Changes to this file must follow the http://aka.ms/api-review process.
// ------------------------------------------------------------------------------
namespace System.Security.Cryptography
{
public partial class AsnEncodedData
{
protected AsnEncodedData() { }
public AsnEncodedData(byte[] rawData) { }
public AsnEncodedData(System.Security.Cryptography.AsnEncodedData asnEncodedData) { }
public AsnEncodedData(System.Security.Cryptography.Oid oid, byte[] rawData) { }
public AsnEncodedData(string oid, byte[] rawData) { }
public System.Security.Cryptography.Oid Oid { get { throw null; } set { } }
public byte[] RawData { get { throw null; } set { } }
public virtual void CopyFrom(System.Security.Cryptography.AsnEncodedData asnEncodedData) { }
public virtual string Format(bool multiLine) { throw null; }
}
public sealed partial class AsnEncodedDataCollection : System.Collections.ICollection, System.Collections.IEnumerable
{
public AsnEncodedDataCollection() { }
public AsnEncodedDataCollection(System.Security.Cryptography.AsnEncodedData asnEncodedData) { }
public int Count { get { throw null; } }
public bool IsSynchronized { get { throw null; } }
public System.Security.Cryptography.AsnEncodedData this[int index] { get { throw null; } }
public object SyncRoot { get { throw null; } }
public int Add(System.Security.Cryptography.AsnEncodedData asnEncodedData) { throw null; }
public void CopyTo(System.Security.Cryptography.AsnEncodedData[] array, int index) { }
public System.Security.Cryptography.AsnEncodedDataEnumerator GetEnumerator() { throw null; }
public void Remove(System.Security.Cryptography.AsnEncodedData asnEncodedData) { }
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
}
public sealed partial class AsnEncodedDataEnumerator : System.Collections.IEnumerator
{
internal AsnEncodedDataEnumerator() { }
public System.Security.Cryptography.AsnEncodedData Current { get { throw null; } }
object System.Collections.IEnumerator.Current { get { throw null; } }
public bool MoveNext() { throw null; }
public void Reset() { }
}
public partial class FromBase64Transform : System.IDisposable, System.Security.Cryptography.ICryptoTransform
{
public FromBase64Transform() { }
public FromBase64Transform(System.Security.Cryptography.FromBase64TransformMode whitespaces) { }
public virtual bool CanReuseTransform { get { throw null; } }
public bool CanTransformMultipleBlocks { get { throw null; } }
public int InputBlockSize { get { throw null; } }
public int OutputBlockSize { get { throw null; } }
public void Clear() { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
~FromBase64Transform() { }
public int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset) { throw null; }
public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount) { throw null; }
}
public enum FromBase64TransformMode
{
DoNotIgnoreWhiteSpaces = 1,
IgnoreWhiteSpaces = 0,
}
public sealed partial class Oid
{
public Oid() { }
public Oid(System.Security.Cryptography.Oid oid) { }
public Oid(string oid) { }
public Oid(string value, string friendlyName) { }
public string FriendlyName { get { throw null; } set { } }
public string Value { get { throw null; } set { } }
public static System.Security.Cryptography.Oid FromFriendlyName(string friendlyName, System.Security.Cryptography.OidGroup group) { throw null; }
public static System.Security.Cryptography.Oid FromOidValue(string oidValue, System.Security.Cryptography.OidGroup group) { throw null; }
}
public sealed partial class OidCollection : System.Collections.ICollection, System.Collections.IEnumerable
{
public OidCollection() { }
public int Count { get { throw null; } }
public bool IsSynchronized { get { throw null; } }
public System.Security.Cryptography.Oid this[int index] { get { throw null; } }
public System.Security.Cryptography.Oid this[string oid] { get { throw null; } }
public object SyncRoot { get { throw null; } }
public int Add(System.Security.Cryptography.Oid oid) { throw null; }
public void CopyTo(System.Security.Cryptography.Oid[] array, int index) { }
public System.Security.Cryptography.OidEnumerator GetEnumerator() { throw null; }
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
}
public sealed partial class OidEnumerator : System.Collections.IEnumerator
{
internal OidEnumerator() { }
public System.Security.Cryptography.Oid Current { get { throw null; } }
object System.Collections.IEnumerator.Current { get { throw null; } }
public bool MoveNext() { throw null; }
public void Reset() { }
}
public enum OidGroup
{
All = 0,
Attribute = 5,
EncryptionAlgorithm = 2,
EnhancedKeyUsage = 7,
ExtensionOrAttribute = 6,
HashAlgorithm = 1,
KeyDerivationFunction = 10,
Policy = 8,
PublicKeyAlgorithm = 3,
SignatureAlgorithm = 4,
Template = 9,
}
public partial class ToBase64Transform : System.IDisposable, System.Security.Cryptography.ICryptoTransform
{
public ToBase64Transform() { }
public virtual bool CanReuseTransform { get { throw null; } }
public bool CanTransformMultipleBlocks { get { throw null; } }
public int InputBlockSize { get { throw null; } }
public int OutputBlockSize { get { throw null; } }
public void Clear() { }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
~ToBase64Transform() { }
public int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset) { throw null; }
public byte[] TransformFinalBlock(byte[] inputBuffer, int inputOffset, int inputCount) { throw null; }
}
}

View File

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

View File

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

View File

@@ -0,0 +1,15 @@
// 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.
namespace Internal.Cryptography
{
internal abstract partial class AsnFormatter
{
private static readonly AsnFormatter s_instance = new OpenSslAsnFormatter();
// -----------------------------
// ---- PAL layer ends here ----
// -----------------------------
}
}

View File

@@ -0,0 +1,15 @@
// 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.
namespace Internal.Cryptography
{
internal abstract partial class AsnFormatter
{
private static readonly AsnFormatter s_instance = new CngAsnFormatter();
// -----------------------------
// ---- PAL layer ends here ----
// -----------------------------
}
}

View File

@@ -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.Cryptography;
namespace Internal.Cryptography
{
internal abstract partial class AsnFormatter
{
private static readonly char[] s_hexValues =
{ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
internal static AsnFormatter Instance { get { return s_instance; } }
public string Format(Oid oid, byte[] rawData, bool multiLine)
{
return FormatNative(oid, rawData, multiLine) ?? EncodeHexString(rawData);
}
protected abstract string FormatNative(Oid oid, byte[] rawData, bool multiLine);
protected static string EncodeHexString(byte[] sArray, bool spaceSeparated = false)
{
return EncodeHexString(sArray, 0, (uint)sArray.Length, spaceSeparated);
}
private static string EncodeHexString(byte[] sArray, uint start, uint end, bool spaceSeparated)
{
string result = null;
if (sArray != null)
{
uint len = (end - start) * 2;
if (spaceSeparated)
{
// There will be n-1 spaces between n bytes.
len += (end - start - 1);
}
char[] hexOrder = new char[len];
for (uint i = start, j = 0; i < end; i++)
{
if (spaceSeparated && i > start)
{
hexOrder[j++] = ' ';
}
uint digit = (uint)((sArray[i] & 0xf0) >> 4);
hexOrder[j++] = s_hexValues[digit];
digit = (uint)(sArray[i] & 0x0f);
hexOrder[j++] = s_hexValues[digit];
}
result = new string(hexOrder);
}
return result;
}
}
}

View File

@@ -0,0 +1,25 @@
// 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;
using System.Security.Cryptography;
using Internal.NativeCrypto;
namespace Internal.Cryptography
{
internal sealed class CngAsnFormatter : AsnFormatter
{
protected override string FormatNative(Oid oid, byte[] rawData, bool multiLine)
{
// If OID is not present, then we can force CryptFormatObject
// to use hex formatting by providing an empty OID string.
String oidValue = String.Empty;
if (oid != null && oid.Value != null)
oidValue = oid.Value;
return Cng.CryptFormatObject(oidValue, rawData, multiLine);
}
}
}

View File

@@ -0,0 +1,24 @@
// 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;
using System.Diagnostics;
using System.Security.Cryptography;
namespace Internal.Cryptography
{
internal static class Helpers
{
public static byte[] CloneByteArray(this byte[] src)
{
if (src == null)
{
return null;
}
return (byte[])(src.Clone());
}
}
}

View File

@@ -0,0 +1,55 @@
// 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;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
namespace Internal.Cryptography
{
internal static partial class OidLookup
{
private static bool ShouldUseCache(OidGroup oidGroup)
{
return true;
}
private static string NativeOidToFriendlyName(string oid, OidGroup oidGroup, bool fallBackToAllGroups)
{
IntPtr friendlyNamePtr = IntPtr.Zero;
int result = Interop.Crypto.LookupFriendlyNameByOid(oid, ref friendlyNamePtr);
switch (result)
{
case 1: /* Success */
Debug.Assert(friendlyNamePtr != IntPtr.Zero, "friendlyNamePtr != IntPtr.Zero");
// The pointer is to a shared string, so marshalling it out is all that's required.
return Marshal.PtrToStringAnsi(friendlyNamePtr);
case -1: /* OpenSSL internal error */
throw Interop.Crypto.CreateOpenSslCryptographicException();
default:
Debug.Assert(result == 0, "LookupFriendlyNameByOid returned unexpected result " + result);
return null;
}
}
private static string NativeFriendlyNameToOid(string friendlyName, OidGroup oidGroup, bool fallBackToAllGroups)
{
IntPtr sharedObject = Interop.Crypto.GetObjectDefinitionByName(friendlyName);
if (sharedObject == IntPtr.Zero)
{
return null;
}
return Interop.Crypto.GetOidValue(sharedObject);
}
// -----------------------------
// ---- PAL layer ends here ----
// -----------------------------
}
}

View File

@@ -0,0 +1,34 @@
// 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.Cryptography;
using static Interop.Crypt32;
namespace Internal.Cryptography
{
internal static partial class OidLookup
{
private static bool ShouldUseCache(OidGroup oidGroup)
{
return oidGroup == OidGroup.All;
}
private static string NativeOidToFriendlyName(string oid, OidGroup oidGroup, bool fallBackToAllGroups)
{
CRYPT_OID_INFO oidInfo = Interop.Crypt32.FindOidInfo(CryptOidInfoKeyType.CRYPT_OID_INFO_OID_KEY, oid, oidGroup, fallBackToAllGroups);
return oidInfo.Name;
}
private static string NativeFriendlyNameToOid(string friendlyName, OidGroup oidGroup, bool fallBackToAllGroups)
{
CRYPT_OID_INFO oidInfo = Interop.Crypt32.FindOidInfo(CryptOidInfoKeyType.CRYPT_OID_INFO_NAME_KEY, friendlyName, oidGroup, fallBackToAllGroups);
return oidInfo.OID;
}
// -----------------------------
// ---- PAL layer ends here ----
// -----------------------------
}
}

View File

@@ -0,0 +1,234 @@
// 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;
using System.Linq;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Security.Cryptography;
namespace Internal.Cryptography
{
internal static partial class OidLookup
{
private static readonly ConcurrentDictionary<string, string> s_lateBoundOidToFriendlyName =
new ConcurrentDictionary<string, string>();
private static readonly ConcurrentDictionary<string, string> s_lateBoundFriendlyNameToOid =
new ConcurrentDictionary<string, string>(StringComparer.OrdinalIgnoreCase);
//
// Attempts to map a friendly name to an OID. Returns null if not a known name.
//
public static string ToFriendlyName(string oid, OidGroup oidGroup, bool fallBackToAllGroups)
{
if (oid == null)
throw new ArgumentNullException(nameof(oid));
string mappedName;
bool shouldUseCache = ShouldUseCache(oidGroup);
// On Unix shouldUseCache is always true, so no matter what OidGroup is passed in the Windows
// friendly name will be returned.
//
// On Windows shouldUseCache is only true for OidGroup.All, because otherwise the OS may filter
// out the answer based on the group criteria.
if (shouldUseCache)
{
if (s_oidToFriendlyName.TryGetValue(oid, out mappedName) ||
s_compatOids.TryGetValue(oid, out mappedName) ||
s_lateBoundOidToFriendlyName.TryGetValue(oid, out mappedName))
{
return mappedName;
}
}
mappedName = NativeOidToFriendlyName(oid, oidGroup, fallBackToAllGroups);
if (shouldUseCache && mappedName != null)
{
s_lateBoundOidToFriendlyName.TryAdd(oid, mappedName);
// Don't add the reverse here. Just because oid => name doesn't mean name => oid.
// And don't bother doing the reverse lookup proactively, just wait until they ask for it.
}
return mappedName;
}
//
// Attempts to retrieve the friendly name for an OID. Returns null if not a known or valid OID.
//
public static string ToOid(string friendlyName, OidGroup oidGroup, bool fallBackToAllGroups)
{
if (friendlyName == null)
throw new ArgumentNullException(nameof(friendlyName));
if (friendlyName.Length == 0)
return null;
string mappedOid;
bool shouldUseCache = ShouldUseCache(oidGroup);
if (shouldUseCache)
{
if (s_friendlyNameToOid.TryGetValue(friendlyName, out mappedOid) ||
s_lateBoundFriendlyNameToOid.TryGetValue(friendlyName, out mappedOid))
{
return mappedOid;
}
}
mappedOid = NativeFriendlyNameToOid(friendlyName, oidGroup, fallBackToAllGroups);
if (shouldUseCache && mappedOid != null)
{
s_lateBoundFriendlyNameToOid.TryAdd(friendlyName, mappedOid);
// Don't add the reverse here. Friendly Name => OID is a case insensitive search,
// so the casing provided as input here may not be the 'correct' one. Just let
// ToFriendlyName capture the response and cache it itself.
}
return mappedOid;
}
// This table was originally built by extracting every szOID #define out of wincrypt.h,
// and running them through new Oid(string) on Windows 10. Then, take the list of everything
// which produced a FriendlyName value, and run it through two other languages. If all 3 agree
// on the mapping, consider the value to be non-localized.
//
// This original list was produced on English (Win10), cross-checked with Spanish (Win8.1) and
// Japanese (Win10).
//
// Sometimes wincrypt.h has more than one OID which results in the same name. The OIDs whose value
// doesn't roundtrip (new Oid(new Oid(value).FriendlyName).Value) are contained in s_compatOids.
//
// X-Plat: The names (and casing) in this table come from Windows. Part of the intent of this table
// is to prevent issues wherein an identifier is different between CoreFX\Windows and CoreFX\Unix;
// since any existing code would be using the Windows identifier, it is the de facto standard.
private static readonly Dictionary<string, string> s_friendlyNameToOid =
new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
{ "3des", "1.2.840.113549.3.7" },
{ "aes128", "2.16.840.1.101.3.4.1.2" },
{ "aes128wrap", "2.16.840.1.101.3.4.1.5" },
{ "aes192", "2.16.840.1.101.3.4.1.22" },
{ "aes192wrap", "2.16.840.1.101.3.4.1.25" },
{ "aes256", "2.16.840.1.101.3.4.1.42" },
{ "aes256wrap", "2.16.840.1.101.3.4.1.45" },
{ "brainpoolP160r1", "1.3.36.3.3.2.8.1.1.1" },
{ "brainpoolP160t1", "1.3.36.3.3.2.8.1.1.2" },
{ "brainpoolP192r1", "1.3.36.3.3.2.8.1.1.3" },
{ "brainpoolP192t1", "1.3.36.3.3.2.8.1.1.4" },
{ "brainpoolP224r1", "1.3.36.3.3.2.8.1.1.5" },
{ "brainpoolP224t1", "1.3.36.3.3.2.8.1.1.6" },
{ "brainpoolP256r1", "1.3.36.3.3.2.8.1.1.7" },
{ "brainpoolP256t1", "1.3.36.3.3.2.8.1.1.8" },
{ "brainpoolP320r1", "1.3.36.3.3.2.8.1.1.9" },
{ "brainpoolP320t1", "1.3.36.3.3.2.8.1.1.10" },
{ "brainpoolP384r1", "1.3.36.3.3.2.8.1.1.11" },
{ "brainpoolP384t1", "1.3.36.3.3.2.8.1.1.12" },
{ "brainpoolP512r1", "1.3.36.3.3.2.8.1.1.13" },
{ "brainpoolP512t1", "1.3.36.3.3.2.8.1.1.14" },
{ "C", "2.5.4.6" },
{ "CMS3DESwrap", "1.2.840.113549.1.9.16.3.6" },
{ "CMSRC2wrap", "1.2.840.113549.1.9.16.3.7" },
{ "CN", "2.5.4.3" },
{ "CPS", "1.3.6.1.5.5.7.2.1" },
{ "DC", "0.9.2342.19200300.100.1.25" },
{ "des", "1.3.14.3.2.7" },
{ "Description", "2.5.4.13" },
{ "DH", "1.2.840.10046.2.1" },
{ "dnQualifier", "2.5.4.46" },
{ "DSA", "1.2.840.10040.4.1" },
{ "dsaSHA1", "1.3.14.3.2.27" },
{ "E", "1.2.840.113549.1.9.1" },
{ "ec192wapi", "1.2.156.11235.1.1.2.1" },
{ "ECC", "1.2.840.10045.2.1" },
{ "ECDH_STD_SHA1_KDF", "1.3.133.16.840.63.0.2" },
{ "ECDH_STD_SHA256_KDF", "1.3.132.1.11.1" },
{ "ECDH_STD_SHA384_KDF", "1.3.132.1.11.2" },
{ "ECDSA_P256", "1.2.840.10045.3.1.7" },
{ "ECDSA_P384", "1.3.132.0.34" },
{ "ECDSA_P521", "1.3.132.0.35" },
{ "ESDH", "1.2.840.113549.1.9.16.3.5" },
{ "G", "2.5.4.42" },
{ "I", "2.5.4.43" },
{ "L", "2.5.4.7" },
{ "md2", "1.2.840.113549.2.2" },
{ "md2RSA", "1.2.840.113549.1.1.2" },
{ "md4", "1.2.840.113549.2.4" },
{ "md4RSA", "1.2.840.113549.1.1.3" },
{ "md5", "1.2.840.113549.2.5" },
{ "md5RSA", "1.2.840.113549.1.1.4" },
{ "mgf1", "1.2.840.113549.1.1.8" },
{ "mosaicKMandUpdSig", "2.16.840.1.101.2.1.1.20" },
{ "mosaicUpdatedSig", "2.16.840.1.101.2.1.1.19" },
{ "nistP192", "1.2.840.10045.3.1.1" },
{ "nistP224", "1.3.132.0.33" },
{ "NO_SIGN", "1.3.6.1.5.5.7.6.2" },
{ "O", "2.5.4.10" },
{ "OU", "2.5.4.11" },
{ "Phone", "2.5.4.20" },
{ "POBox", "2.5.4.18" },
{ "PostalCode", "2.5.4.17" },
{ "rc2", "1.2.840.113549.3.2" },
{ "rc4", "1.2.840.113549.3.4" },
{ "RSA", "1.2.840.113549.1.1.1" },
{ "RSAES_OAEP", "1.2.840.113549.1.1.7" },
{ "RSASSA-PSS", "1.2.840.113549.1.1.10" },
{ "S", "2.5.4.8" },
{ "secP160k1", "1.3.132.0.9" },
{ "secP160r1", "1.3.132.0.8" },
{ "secP160r2", "1.3.132.0.30" },
{ "secP192k1", "1.3.132.0.31" },
{ "secP224k1", "1.3.132.0.32" },
{ "secP256k1", "1.3.132.0.10" },
{ "SERIALNUMBER", "2.5.4.5" },
{ "sha1", "1.3.14.3.2.26" },
{ "sha1DSA", "1.2.840.10040.4.3" },
{ "sha1ECDSA", "1.2.840.10045.4.1" },
{ "sha1RSA", "1.2.840.113549.1.1.5" },
{ "sha256", "2.16.840.1.101.3.4.2.1" },
{ "sha256ECDSA", "1.2.840.10045.4.3.2" },
{ "sha256RSA", "1.2.840.113549.1.1.11" },
{ "sha384", "2.16.840.1.101.3.4.2.2" },
{ "sha384ECDSA", "1.2.840.10045.4.3.3" },
{ "sha384RSA", "1.2.840.113549.1.1.12" },
{ "sha512", "2.16.840.1.101.3.4.2.3" },
{ "sha512ECDSA", "1.2.840.10045.4.3.4" },
{ "sha512RSA", "1.2.840.113549.1.1.13" },
{ "SN", "2.5.4.4" },
{ "specifiedECDSA", "1.2.840.10045.4.3" },
{ "STREET", "2.5.4.9" },
{ "T", "2.5.4.12" },
{ "wtls9", "2.23.43.1.4.9" },
{ "X21Address", "2.5.4.24" },
{ "x962P192v2", "1.2.840.10045.3.1.2" },
{ "x962P192v3", "1.2.840.10045.3.1.3" },
{ "x962P239v1", "1.2.840.10045.3.1.4" },
{ "x962P239v2", "1.2.840.10045.3.1.5" },
{ "x962P239v3", "1.2.840.10045.3.1.6" },
};
private static readonly Dictionary<string, string> s_oidToFriendlyName =
s_friendlyNameToOid.ToDictionary(kvp => kvp.Value, kvp => kvp.Key);
private static readonly Dictionary<string, string> s_compatOids =
new Dictionary<string, string>
{
{ "1.2.840.113549.1.3.1", "DH" },
{ "1.3.14.3.2.12", "DSA" },
{ "1.3.14.3.2.13", "sha1DSA" },
{ "1.3.14.3.2.15", "shaRSA" },
{ "1.3.14.3.2.18", "sha" },
{ "1.3.14.3.2.2", "md4RSA" },
{ "1.3.14.3.2.22", "RSA_KEYX" },
{ "1.3.14.3.2.29", "sha1RSA" },
{ "1.3.14.3.2.3", "md5RSA" },
{ "1.3.14.3.2.4", "md4RSA" },
{ "1.3.14.7.2.3.1", "md2RSA" },
};
}
}

View File

@@ -0,0 +1,68 @@
// 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;
using System.Security.Cryptography;
using System.Text;
using Microsoft.Win32.SafeHandles;
namespace Internal.Cryptography
{
internal sealed class OpenSslAsnFormatter : AsnFormatter
{
protected override string FormatNative(Oid oid, byte[] rawData, bool multiLine)
{
if (oid == null || string.IsNullOrEmpty(oid.Value))
{
return EncodeHexString(rawData, true);
}
// The established behavior for this method is to return the native answer, if possible,
// or to return null and let rawData get hex-encoded. CryptographicException should not
// be raised.
using (SafeAsn1ObjectHandle asnOid = Interop.Crypto.ObjTxt2Obj(oid.Value))
using (SafeAsn1OctetStringHandle octetString = Interop.Crypto.Asn1OctetStringNew())
{
if (asnOid.IsInvalid || octetString.IsInvalid)
{
return null;
}
if (!Interop.Crypto.Asn1OctetStringSet(octetString, rawData, rawData.Length))
{
return null;
}
using (SafeBioHandle bio = Interop.Crypto.CreateMemoryBio())
using (SafeX509ExtensionHandle x509Ext = Interop.Crypto.X509ExtensionCreateByObj(asnOid, false, octetString))
{
if (bio.IsInvalid || x509Ext.IsInvalid)
{
return null;
}
if (!Interop.Crypto.X509V3ExtPrint(bio, x509Ext))
{
return null;
}
int printLen = Interop.Crypto.GetMemoryBioSize(bio);
// Account for the null terminator that it'll want to write.
var buf = new byte[printLen + 1];
int read = Interop.Crypto.BioGets(bio, buf, buf.Length);
if (read < 0)
{
throw Interop.Crypto.CreateOpenSslCryptographicException();
}
return Encoding.UTF8.GetString(buf, 0, read);
}
}
}
}
}

View File

@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Cryptography_Oid_InvalidValue" xml:space="preserve">
<value>The OID value is invalid.</value>
</data>
<data name="Cryptography_Oid_InvalidName" xml:space="preserve">
<value>No OID value matches this name.</value>
</data>
<data name="Cryptography_SSE_InvalidDataSize" xml:space="preserve">
<value>NoLength of the data to encrypt is invalid.</value>
</data>
<data name="Arg_RankMultiDimNotSupported" xml:space="preserve">
<value>Only single dimensional arrays are supported for the requested action.</value>
</data>
<data name="ArgumentOutOfRange_Index" xml:space="preserve">
<value>Index was out of range. Must be non-negative and less than the size of the collection.</value>
</data>
<data name="ArgumentOutOfRange_NeedNonNegNum" xml:space="preserve">
<value>Non-negative number required.</value>
</data>
<data name="Argument_InvalidOffLen" xml:space="preserve">
<value>Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.</value>
</data>
<data name="Argument_InvalidValue" xml:space="preserve">
<value>Value was invalid.</value>
</data>
<data name="ObjectDisposed_Generic" xml:space="preserve">
<value>Cannot access a disposed object.</value>
</data>
</root>

View File

@@ -0,0 +1,108 @@
<?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>{AA81E343-5E54-40B0-9381-C459419BE780}</ProjectGuid>
<AssemblyName>System.Security.Cryptography.Encoding</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net463'">true</IsPartialFacadeAssembly>
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net463'">None</ResourcesSourceOutputDirectory>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net463-Windows_NT-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net463-Windows_NT-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'" />
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
<Compile Include="Internal\Cryptography\AsnFormatter.cs" />
<Compile Include="Internal\Cryptography\Helpers.cs" />
<Compile Include="Internal\Cryptography\OidLookup.cs" />
<Compile Include="System\Security\Cryptography\AsnEncodedData.cs" />
<Compile Include="System\Security\Cryptography\AsnEncodedDataCollection.cs" />
<Compile Include="System\Security\Cryptography\AsnEncodedDataEnumerator.cs" />
<Compile Include="System\Security\Cryptography\Base64Transforms.cs" />
<Compile Include="System\Security\Cryptography\Oid.cs" />
<Compile Include="System\Security\Cryptography\OidCollection.cs" />
<Compile Include="System\Security\Cryptography\OidEnumerator.cs" />
<Compile Include="System\Security\Cryptography\OidGroup.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetsWindows)' == 'true' And '$(TargetGroup)' == 'netcoreapp'">
<Compile Include="Internal\Cryptography\AsnFormatter.Windows.cs" />
<Compile Include="Internal\Cryptography\CngAsnFormatter.cs" />
<Compile Include="Internal\Cryptography\OidLookup.Windows.cs" />
<Compile Include="$(CommonPath)\Interop\Windows\BCrypt\Cng.cs">
<Link>Common\Interop\Windows\BCrypt\Cng.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\BCrypt\Interop.BCryptPropertyStrings.cs">
<Link>Common\Interop\Windows\BCrypt\Interop.BCryptPropertyStrings.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\Crypt32\Interop.FindOidInfo.cs">
<Link>Common\Interop\Windows\Crypt32\Interop.FindOidInfo.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Internal\Cryptography\Windows\CryptoThrowHelper.cs">
<Link>Internal\Cryptography\Windows\CryptoThrowHelper.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\kernel32\Interop.FormatMessage.cs">
<Link>Internal\Windows\kernel32\Interop.FormatMessage.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Windows\Interop.Libraries.cs">
<Link>Common\Interop\Windows\Interop.Libraries.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition=" '$(TargetsUnix)' == 'true' ">
<Compile Include="Internal\Cryptography\AsnFormatter.Unix.cs" />
<Compile Include="Internal\Cryptography\OidLookup.Unix.cs" />
<Compile Include="Internal\Cryptography\OpenSslAsnFormatter.cs" />
<Compile Include="$(CommonPath)\Interop\Unix\Interop.Libraries.cs">
<Link>Common\Interop\Unix\Interop.Libraries.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.ASN1.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.ASN1.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.BIO.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.BIO.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.ERR.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.ERR.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.Initialization.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.Initialization.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.LookupFriendlyNameByOid.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.LookupFriendlyNameByOid.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Interop\Unix\System.Security.Cryptography.Native\Interop.X509Ext.cs">
<Link>Common\Interop\Unix\System.Security.Cryptography.Native\Interop.X509Ext.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\Asn1SafeHandles.Unix.cs">
<Link>Common\Microsoft\Win32\SafeHandles\Asn1SafeHandles.Unix.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeBioHandle.Unix.cs">
<Link>Common\Microsoft\Win32\SafeHandles\SafeBioHandle.Unix.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\SafeInteriorHandle.cs">
<Link>Common\Microsoft\Win32\SafeHandles\SafeInteriorHandle.cs</Link>
</Compile>
<Compile Include="$(CommonPath)\Microsoft\Win32\SafeHandles\X509ExtensionSafeHandles.Unix.cs">
<Link>Common\Microsoft\Win32\SafeHandles\X509ExtensionSafeHandles.Unix.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'net463'">
<TargetingPackReference Include="mscorlib" />
<TargetingPackReference Include="System" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Collections" />
<Reference Include="System.Collections.Concurrent" />
<Reference Include="System.Diagnostics.Contracts" />
<Reference Include="System.Diagnostics.Debug" />
<Reference Include="System.Linq" />
<Reference Include="System.Resources.ResourceManager" />
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.Extensions" />
<Reference Include="System.Runtime.InteropServices" />
<Reference Include="System.Security.Cryptography.Primitives" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -0,0 +1,94 @@
// 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;
using System.Diagnostics;
using Internal.Cryptography;
namespace System.Security.Cryptography
{
public class AsnEncodedData
{
protected AsnEncodedData()
{
}
public AsnEncodedData(byte[] rawData)
{
Reset(null, rawData);
}
public AsnEncodedData(AsnEncodedData asnEncodedData)
{
if (asnEncodedData == null)
throw new ArgumentNullException(nameof(asnEncodedData));
Reset(asnEncodedData._oid, asnEncodedData._rawData);
}
public AsnEncodedData(Oid oid, byte[] rawData)
{
Reset(oid, rawData);
}
public AsnEncodedData(String oid, byte[] rawData)
{
Reset(new Oid(oid), rawData);
}
public Oid Oid
{
get
{
return _oid;
}
set
{
_oid = (value == null) ? null : new Oid(value);
}
}
public byte[] RawData
{
get
{
// Desktop compat demands we return the array without copying.
return _rawData;
}
set
{
if (value == null)
throw new ArgumentNullException(nameof(value));
_rawData = value.CloneByteArray();
}
}
public virtual void CopyFrom(AsnEncodedData asnEncodedData)
{
if (asnEncodedData == null)
throw new ArgumentNullException(nameof(asnEncodedData));
Reset(asnEncodedData._oid, asnEncodedData._rawData);
}
public virtual String Format(bool multiLine)
{
// Return empty string if no data to format.
if (_rawData == null || _rawData.Length == 0)
return String.Empty;
return AsnFormatter.Instance.Format(_oid, _rawData, multiLine);
}
private void Reset(Oid oid, byte[] rawData)
{
this.Oid = oid;
this.RawData = rawData;
}
private Oid _oid = null;
private byte[] _rawData = null;
}
}

View File

@@ -0,0 +1,117 @@
// 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;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
namespace System.Security.Cryptography
{
public sealed class AsnEncodedDataCollection : ICollection
{
public AsnEncodedDataCollection()
{
_list = new List<AsnEncodedData>();
}
public AsnEncodedDataCollection(AsnEncodedData asnEncodedData)
: this()
{
_list.Add(asnEncodedData);
}
public int Add(AsnEncodedData asnEncodedData)
{
if (asnEncodedData == null)
throw new ArgumentNullException(nameof(asnEncodedData));
int indexOfNewItem = _list.Count;
_list.Add(asnEncodedData);
return indexOfNewItem;
}
public void Remove(AsnEncodedData asnEncodedData)
{
if (asnEncodedData == null)
throw new ArgumentNullException(nameof(asnEncodedData));
_list.Remove(asnEncodedData);
}
public AsnEncodedData this[int index]
{
get
{
return _list[index];
}
}
public int Count
{
get
{
return _list.Count;
}
}
public AsnEncodedDataEnumerator GetEnumerator()
{
return new AsnEncodedDataEnumerator(this);
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
void ICollection.CopyTo(Array array, int index)
{
if (array == null)
throw new ArgumentNullException(nameof(array));
if (array.Rank != 1)
throw new ArgumentException(SR.Arg_RankMultiDimNotSupported);
if (index < 0 || index >= array.Length)
throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
if (Count > array.Length - index)
throw new ArgumentException(SR.Argument_InvalidOffLen);
for (int i = 0; i < Count; i++)
{
array.SetValue(this[i], index);
index++;
}
}
public void CopyTo(AsnEncodedData[] array, int index)
{
// Need to do part of the argument validation ourselves as AsnEncodedDataCollection throws
// ArgumentOutOfRangeException where List<>.CopyTo() throws ArgumentException.
if (array == null)
throw new ArgumentNullException(nameof(array));
if (index < 0 || index >= array.Length)
throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_Index);
_list.CopyTo(array, index);
}
public bool IsSynchronized
{
get
{
return false;
}
}
public object SyncRoot
{
get
{
return this;
}
}
private readonly List<AsnEncodedData> _list;
}
}

View File

@@ -0,0 +1,52 @@
// 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;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
namespace System.Security.Cryptography
{
public sealed class AsnEncodedDataEnumerator : IEnumerator
{
internal AsnEncodedDataEnumerator(AsnEncodedDataCollection asnEncodedDatas)
{
_asnEncodedDatas = asnEncodedDatas;
_current = -1;
}
public AsnEncodedData Current
{
get
{
return _asnEncodedDatas[_current];
}
}
object IEnumerator.Current
{
get
{
return _asnEncodedDatas[_current];
}
}
public bool MoveNext()
{
if (_current >= _asnEncodedDatas.Count - 1)
return false;
_current++;
return true;
}
public void Reset()
{
_current = -1;
}
private readonly AsnEncodedDataCollection _asnEncodedDatas;
private int _current;
}
}

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