You've already forked linux-packaging-mono
Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
parent
1190d13a04
commit
6bdd276d05
101
external/corefx/src/System.Security.Cryptography.Pkcs/System.Security.Cryptography.Pkcs.sln
vendored
Normal file
101
external/corefx/src/System.Security.Cryptography.Pkcs/System.Security.Cryptography.Pkcs.sln
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25123.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Security.Cryptography.Pkcs.Tests", "tests\System.Security.Cryptography.Pkcs.Tests.csproj", "{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D} = {03D84CBD-896D-4B2F-9A22-07034F51E73D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Security.Cryptography.Pkcs", "src\System.Security.Cryptography.Pkcs.csproj", "{03D84CBD-896D-4B2F-9A22-07034F51E73D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
DebugNETCoreAppnetcore50-Windows_NTnetcoreapp-Windows_NT|AnyCPU = DebugNETCoreAppnetcore50-Windows_NTnetcoreapp-Windows_NT|AnyCPU
|
||||
ReleaseNETCoreAppnetcore50-Windows_NTnetcoreapp-Windows_NT|AnyCPU = ReleaseNETCoreAppnetcore50-Windows_NTnetcoreapp-Windows_NT|AnyCPU
|
||||
DebugNETCoreAppnetcore50-Windows_NTnetstandard1.3-Windows_NT|AnyCPU = DebugNETCoreAppnetcore50-Windows_NTnetstandard1.3-Windows_NT|AnyCPU
|
||||
ReleaseNETCoreAppnetcore50-Windows_NTnetstandard1.3-Windows_NT|AnyCPU = ReleaseNETCoreAppnetcore50-Windows_NTnetstandard1.3-Windows_NT|AnyCPU
|
||||
DebugNETCoreAppnetstandard1.3-Windows_NTnetcoreapp-Windows_NT|AnyCPU = DebugNETCoreAppnetstandard1.3-Windows_NTnetcoreapp-Windows_NT|AnyCPU
|
||||
ReleaseNETCoreAppnetstandard1.3-Windows_NTnetcoreapp-Windows_NT|AnyCPU = ReleaseNETCoreAppnetstandard1.3-Windows_NTnetcoreapp-Windows_NT|AnyCPU
|
||||
DebugNETCoreAppnetstandard1.3-Windows_NTnetstandard1.3-Windows_NT|AnyCPU = DebugNETCoreAppnetstandard1.3-Windows_NTnetstandard1.3-Windows_NT|AnyCPU
|
||||
ReleaseNETCoreAppnetstandard1.3-Windows_NTnetstandard1.3-Windows_NT|AnyCPU = ReleaseNETCoreAppnetstandard1.3-Windows_NTnetstandard1.3-Windows_NT|AnyCPU
|
||||
DebugNETCoreAppnetstandard1.3-Unixnetcoreapp-Windows_NT|AnyCPU = DebugNETCoreAppnetstandard1.3-Unixnetcoreapp-Windows_NT|AnyCPU
|
||||
ReleaseNETCoreAppnetstandard1.3-Unixnetcoreapp-Windows_NT|AnyCPU = ReleaseNETCoreAppnetstandard1.3-Unixnetcoreapp-Windows_NT|AnyCPU
|
||||
DebugNETCoreAppnetstandard1.3-Unixnetstandard1.3-Windows_NT|AnyCPU = DebugNETCoreAppnetstandard1.3-Unixnetstandard1.3-Windows_NT|AnyCPU
|
||||
ReleaseNETCoreAppnetstandard1.3-Unixnetstandard1.3-Windows_NT|AnyCPU = ReleaseNETCoreAppnetstandard1.3-Unixnetstandard1.3-Windows_NT|AnyCPU
|
||||
DebugNETCoreAppnet46-Windows_NTnetcoreapp-Windows_NT|AnyCPU = DebugNETCoreAppnet46-Windows_NTnetcoreapp-Windows_NT|AnyCPU
|
||||
ReleaseNETCoreAppnet46-Windows_NTnetcoreapp-Windows_NT|AnyCPU = ReleaseNETCoreAppnet46-Windows_NTnetcoreapp-Windows_NT|AnyCPU
|
||||
DebugNETCoreAppnet46-Windows_NTnetstandard1.3-Windows_NT|AnyCPU = DebugNETCoreAppnet46-Windows_NTnetstandard1.3-Windows_NT|AnyCPU
|
||||
ReleaseNETCoreAppnet46-Windows_NTnetstandard1.3-Windows_NT|AnyCPU = ReleaseNETCoreAppnet46-Windows_NTnetstandard1.3-Windows_NT|AnyCPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.DebugNETCoreAppnetcore50-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.DebugNETCoreAppnetcore50-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.ReleaseNETCoreAppnetcore50-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.ReleaseNETCoreAppnetcore50-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.DebugNETCoreAppnetcore50-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Windows_NT-Debug|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.DebugNETCoreAppnetcore50-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Windows_NT-Debug|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.ReleaseNETCoreAppnetcore50-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Windows_NT-Release|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.ReleaseNETCoreAppnetcore50-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Windows_NT-Release|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.DebugNETCoreAppnetstandard1.3-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.DebugNETCoreAppnetstandard1.3-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.ReleaseNETCoreAppnetstandard1.3-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.ReleaseNETCoreAppnetstandard1.3-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.DebugNETCoreAppnetstandard1.3-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Windows_NT-Debug|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.DebugNETCoreAppnetstandard1.3-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Windows_NT-Debug|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.ReleaseNETCoreAppnetstandard1.3-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Windows_NT-Release|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.ReleaseNETCoreAppnetstandard1.3-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Windows_NT-Release|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.DebugNETCoreAppnetstandard1.3-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.DebugNETCoreAppnetstandard1.3-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.ReleaseNETCoreAppnetstandard1.3-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.ReleaseNETCoreAppnetstandard1.3-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.DebugNETCoreAppnetstandard1.3-Unixnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Windows_NT-Debug|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.DebugNETCoreAppnetstandard1.3-Unixnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Windows_NT-Debug|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.ReleaseNETCoreAppnetstandard1.3-Unixnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Windows_NT-Release|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.ReleaseNETCoreAppnetstandard1.3-Unixnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Windows_NT-Release|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.DebugNETCoreAppnet46-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.DebugNETCoreAppnet46-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Debug|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.ReleaseNETCoreAppnet46-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.ReleaseNETCoreAppnet46-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcoreapp-Windows_NT-Release|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.DebugNETCoreAppnet46-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Windows_NT-Debug|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.DebugNETCoreAppnet46-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Windows_NT-Debug|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.ReleaseNETCoreAppnet46-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Windows_NT-Release|Any CPU
|
||||
{2DD8DFFA-09FF-46C6-8313-4A9CC1849A44}.ReleaseNETCoreAppnet46-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Windows_NT-Release|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.DebugNETCoreAppnetcore50-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcore50-Windows_NT-Debug|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.DebugNETCoreAppnetcore50-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcore50-Windows_NT-Debug|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.ReleaseNETCoreAppnetcore50-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netcore50-Windows_NT-Release|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.ReleaseNETCoreAppnetcore50-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netcore50-Windows_NT-Release|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.DebugNETCoreAppnetcore50-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netcore50-Windows_NT-Debug|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.DebugNETCoreAppnetcore50-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netcore50-Windows_NT-Debug|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.ReleaseNETCoreAppnetcore50-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netcore50-Windows_NT-Release|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.ReleaseNETCoreAppnetcore50-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netcore50-Windows_NT-Release|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.DebugNETCoreAppnetstandard1.3-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Windows_NT-Debug|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.DebugNETCoreAppnetstandard1.3-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Windows_NT-Debug|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.ReleaseNETCoreAppnetstandard1.3-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Windows_NT-Release|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.ReleaseNETCoreAppnetstandard1.3-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Windows_NT-Release|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.DebugNETCoreAppnetstandard1.3-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Windows_NT-Debug|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.DebugNETCoreAppnetstandard1.3-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Windows_NT-Debug|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.ReleaseNETCoreAppnetstandard1.3-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Windows_NT-Release|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.ReleaseNETCoreAppnetstandard1.3-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Windows_NT-Release|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.DebugNETCoreAppnetstandard1.3-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Unix-Debug|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.DebugNETCoreAppnetstandard1.3-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Unix-Debug|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.ReleaseNETCoreAppnetstandard1.3-Unixnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Unix-Release|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.ReleaseNETCoreAppnetstandard1.3-Unixnetcoreapp-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Unix-Release|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.DebugNETCoreAppnetstandard1.3-Unixnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Unix-Debug|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.DebugNETCoreAppnetstandard1.3-Unixnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Unix-Debug|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.ReleaseNETCoreAppnetstandard1.3-Unixnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = netstandard1.3-Unix-Release|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.ReleaseNETCoreAppnetstandard1.3-Unixnetstandard1.3-Windows_NT|AnyCPU.Build.0 = netstandard1.3-Unix-Release|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.DebugNETCoreAppnet46-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = net46-Windows_NT-Debug|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.DebugNETCoreAppnet46-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = net46-Windows_NT-Debug|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.ReleaseNETCoreAppnet46-Windows_NTnetcoreapp-Windows_NT|AnyCPU.ActiveCfg = net46-Windows_NT-Release|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.ReleaseNETCoreAppnet46-Windows_NTnetcoreapp-Windows_NT|AnyCPU.Build.0 = net46-Windows_NT-Release|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.DebugNETCoreAppnet46-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = net46-Windows_NT-Debug|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.DebugNETCoreAppnet46-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.Build.0 = net46-Windows_NT-Debug|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.ReleaseNETCoreAppnet46-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.ActiveCfg = net46-Windows_NT-Release|Any CPU
|
||||
{03D84CBD-896D-4B2F-9A22-07034F51E73D}.ReleaseNETCoreAppnet46-Windows_NTnetstandard1.3-Windows_NT|AnyCPU.Build.0 = net46-Windows_NT-Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
7
external/corefx/src/System.Security.Cryptography.Pkcs/dir.props
vendored
Normal file
7
external/corefx/src/System.Security.Cryptography.Pkcs/dir.props
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?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.0.2.0</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -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="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<ItemGroup>
|
||||
<Project Include="System.Security.Cryptography.Pkcs.pkgproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?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>
|
||||
<ProjectReference Include="..\ref\System.Security.Cryptography.Pkcs.csproj">
|
||||
<SupportedFramework>net46;netcore50;netcoreapp1.0</SupportedFramework>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\src\System.Security.Cryptography.Pkcs.builds" />
|
||||
<_xamarinFrameworks Include="$(AllXamarinFrameworks)" />
|
||||
<HarvestSuppressPaths Include="@(_xamarinFrameworks->'ref/%(Identity)')" />
|
||||
<HarvestSuppressPaths Include="@(_xamarinFrameworks->'lib/%(Identity)')" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
8
external/corefx/src/System.Security.Cryptography.Pkcs/ref/Configurations.props
vendored
Normal file
8
external/corefx/src/System.Security.Cryptography.Pkcs/ref/Configurations.props
vendored
Normal 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">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
netstandard;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
251
external/corefx/src/System.Security.Cryptography.Pkcs/ref/System.Security.Cryptography.Pkcs.cs
vendored
Normal file
251
external/corefx/src/System.Security.Cryptography.Pkcs/ref/System.Security.Cryptography.Pkcs.cs
vendored
Normal file
@@ -0,0 +1,251 @@
|
||||
// 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 sealed partial class CryptographicAttributeObject
|
||||
{
|
||||
public CryptographicAttributeObject(System.Security.Cryptography.Oid oid) { }
|
||||
public CryptographicAttributeObject(System.Security.Cryptography.Oid oid, System.Security.Cryptography.AsnEncodedDataCollection values) { }
|
||||
public System.Security.Cryptography.Oid Oid { get { throw null; } }
|
||||
public System.Security.Cryptography.AsnEncodedDataCollection Values { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
||||
}
|
||||
public sealed partial class CryptographicAttributeObjectCollection : System.Collections.ICollection, System.Collections.IEnumerable
|
||||
{
|
||||
public CryptographicAttributeObjectCollection() { }
|
||||
public CryptographicAttributeObjectCollection(System.Security.Cryptography.CryptographicAttributeObject attribute) { }
|
||||
public int Count { get { throw null; } }
|
||||
public System.Security.Cryptography.CryptographicAttributeObject this[int index] { get { throw null; } }
|
||||
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
|
||||
object System.Collections.ICollection.SyncRoot { get { throw null; } }
|
||||
public int Add(System.Security.Cryptography.AsnEncodedData asnEncodedData) { throw null; }
|
||||
public int Add(System.Security.Cryptography.CryptographicAttributeObject attribute) { throw null; }
|
||||
public void CopyTo(System.Security.Cryptography.CryptographicAttributeObject[] array, int index) { }
|
||||
public System.Security.Cryptography.CryptographicAttributeObjectEnumerator GetEnumerator() { throw null; }
|
||||
public void Remove(System.Security.Cryptography.CryptographicAttributeObject attribute) { }
|
||||
void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
|
||||
}
|
||||
public sealed partial class CryptographicAttributeObjectEnumerator : System.Collections.IEnumerator
|
||||
{
|
||||
internal CryptographicAttributeObjectEnumerator() { }
|
||||
public System.Security.Cryptography.CryptographicAttributeObject Current { get { throw null; } }
|
||||
object System.Collections.IEnumerator.Current { get { throw null; } }
|
||||
public bool MoveNext() { throw null; }
|
||||
public void Reset() { }
|
||||
}
|
||||
}
|
||||
namespace System.Security.Cryptography.Pkcs
|
||||
{
|
||||
public sealed partial class AlgorithmIdentifier
|
||||
{
|
||||
public AlgorithmIdentifier() { }
|
||||
public AlgorithmIdentifier(System.Security.Cryptography.Oid oid) { }
|
||||
public AlgorithmIdentifier(System.Security.Cryptography.Oid oid, int keyLength) { }
|
||||
public int KeyLength { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||
public System.Security.Cryptography.Oid Oid { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||
}
|
||||
public sealed partial class CmsRecipient
|
||||
{
|
||||
public CmsRecipient(System.Security.Cryptography.Pkcs.SubjectIdentifierType recipientIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { }
|
||||
public CmsRecipient(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) { }
|
||||
public System.Security.Cryptography.X509Certificates.X509Certificate2 Certificate { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
||||
public System.Security.Cryptography.Pkcs.SubjectIdentifierType RecipientIdentifierType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
||||
}
|
||||
public sealed partial class CmsRecipientCollection : System.Collections.ICollection, System.Collections.IEnumerable
|
||||
{
|
||||
public CmsRecipientCollection() { }
|
||||
public CmsRecipientCollection(System.Security.Cryptography.Pkcs.CmsRecipient recipient) { }
|
||||
public CmsRecipientCollection(System.Security.Cryptography.Pkcs.SubjectIdentifierType recipientIdentifierType, System.Security.Cryptography.X509Certificates.X509Certificate2Collection certificates) { }
|
||||
public int Count { get { throw null; } }
|
||||
public System.Security.Cryptography.Pkcs.CmsRecipient this[int index] { get { throw null; } }
|
||||
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
|
||||
object System.Collections.ICollection.SyncRoot { get { throw null; } }
|
||||
public int Add(System.Security.Cryptography.Pkcs.CmsRecipient recipient) { throw null; }
|
||||
public void CopyTo(System.Array array, int index) { }
|
||||
public void CopyTo(System.Security.Cryptography.Pkcs.CmsRecipient[] array, int index) { }
|
||||
public System.Security.Cryptography.Pkcs.CmsRecipientEnumerator GetEnumerator() { throw null; }
|
||||
public void Remove(System.Security.Cryptography.Pkcs.CmsRecipient recipient) { }
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
|
||||
}
|
||||
public sealed partial class CmsRecipientEnumerator : System.Collections.IEnumerator
|
||||
{
|
||||
internal CmsRecipientEnumerator() { }
|
||||
public System.Security.Cryptography.Pkcs.CmsRecipient Current { get { throw null; } }
|
||||
object System.Collections.IEnumerator.Current { get { throw null; } }
|
||||
public bool MoveNext() { throw null; }
|
||||
public void Reset() { }
|
||||
}
|
||||
public sealed partial class ContentInfo
|
||||
{
|
||||
public ContentInfo(byte[] content) { }
|
||||
public ContentInfo(System.Security.Cryptography.Oid contentType, byte[] content) { }
|
||||
public byte[] Content { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
||||
public System.Security.Cryptography.Oid ContentType { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
||||
public static System.Security.Cryptography.Oid GetContentType(byte[] encodedMessage) { throw null; }
|
||||
}
|
||||
public sealed partial class EnvelopedCms
|
||||
{
|
||||
public EnvelopedCms() { }
|
||||
public EnvelopedCms(System.Security.Cryptography.Pkcs.ContentInfo contentInfo) { }
|
||||
public EnvelopedCms(System.Security.Cryptography.Pkcs.ContentInfo contentInfo, System.Security.Cryptography.Pkcs.AlgorithmIdentifier encryptionAlgorithm) { }
|
||||
public System.Security.Cryptography.X509Certificates.X509Certificate2Collection Certificates { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
||||
public System.Security.Cryptography.Pkcs.AlgorithmIdentifier ContentEncryptionAlgorithm { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
||||
public System.Security.Cryptography.Pkcs.ContentInfo ContentInfo { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
||||
public System.Security.Cryptography.Pkcs.RecipientInfoCollection RecipientInfos { get { throw null; } }
|
||||
public System.Security.Cryptography.CryptographicAttributeObjectCollection UnprotectedAttributes { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
||||
public int Version { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
||||
public void Decode(byte[] encodedMessage) { }
|
||||
public void Decrypt() { }
|
||||
public void Decrypt(System.Security.Cryptography.Pkcs.RecipientInfo recipientInfo) { }
|
||||
public void Decrypt(System.Security.Cryptography.Pkcs.RecipientInfo recipientInfo, System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraStore) { }
|
||||
public void Decrypt(System.Security.Cryptography.X509Certificates.X509Certificate2Collection extraStore) { }
|
||||
public byte[] Encode() { throw null; }
|
||||
public void Encrypt(System.Security.Cryptography.Pkcs.CmsRecipient recipient) { }
|
||||
public void Encrypt(System.Security.Cryptography.Pkcs.CmsRecipientCollection recipients) { }
|
||||
}
|
||||
public sealed partial class KeyAgreeRecipientInfo : System.Security.Cryptography.Pkcs.RecipientInfo
|
||||
{
|
||||
internal KeyAgreeRecipientInfo() { }
|
||||
public System.DateTime Date { get { throw null; } }
|
||||
public override byte[] EncryptedKey { get { throw null; } }
|
||||
public override System.Security.Cryptography.Pkcs.AlgorithmIdentifier KeyEncryptionAlgorithm { get { throw null; } }
|
||||
public System.Security.Cryptography.Pkcs.SubjectIdentifierOrKey OriginatorIdentifierOrKey { get { throw null; } }
|
||||
public System.Security.Cryptography.CryptographicAttributeObject OtherKeyAttribute { get { throw null; } }
|
||||
public override System.Security.Cryptography.Pkcs.SubjectIdentifier RecipientIdentifier { get { throw null; } }
|
||||
public override int Version { get { throw null; } }
|
||||
}
|
||||
public sealed partial class KeyTransRecipientInfo : System.Security.Cryptography.Pkcs.RecipientInfo
|
||||
{
|
||||
internal KeyTransRecipientInfo() { }
|
||||
public override byte[] EncryptedKey { get { throw null; } }
|
||||
public override System.Security.Cryptography.Pkcs.AlgorithmIdentifier KeyEncryptionAlgorithm { get { throw null; } }
|
||||
public override System.Security.Cryptography.Pkcs.SubjectIdentifier RecipientIdentifier { get { throw null; } }
|
||||
public override int Version { get { throw null; } }
|
||||
}
|
||||
public partial class Pkcs9AttributeObject : System.Security.Cryptography.AsnEncodedData
|
||||
{
|
||||
public Pkcs9AttributeObject() { }
|
||||
public Pkcs9AttributeObject(System.Security.Cryptography.AsnEncodedData asnEncodedData) { }
|
||||
public Pkcs9AttributeObject(System.Security.Cryptography.Oid oid, byte[] encodedData) { }
|
||||
public Pkcs9AttributeObject(string oid, byte[] encodedData) { }
|
||||
public new System.Security.Cryptography.Oid Oid { get { throw null; } }
|
||||
public override void CopyFrom(System.Security.Cryptography.AsnEncodedData asnEncodedData) { }
|
||||
}
|
||||
public sealed partial class Pkcs9ContentType : System.Security.Cryptography.Pkcs.Pkcs9AttributeObject
|
||||
{
|
||||
public Pkcs9ContentType() { }
|
||||
public System.Security.Cryptography.Oid ContentType { get { throw null; } }
|
||||
public override void CopyFrom(System.Security.Cryptography.AsnEncodedData asnEncodedData) { }
|
||||
}
|
||||
public sealed partial class Pkcs9DocumentDescription : System.Security.Cryptography.Pkcs.Pkcs9AttributeObject
|
||||
{
|
||||
public Pkcs9DocumentDescription() { }
|
||||
public Pkcs9DocumentDescription(byte[] encodedDocumentDescription) { }
|
||||
public Pkcs9DocumentDescription(string documentDescription) { }
|
||||
public string DocumentDescription { get { throw null; } }
|
||||
public override void CopyFrom(System.Security.Cryptography.AsnEncodedData asnEncodedData) { }
|
||||
}
|
||||
public sealed partial class Pkcs9DocumentName : System.Security.Cryptography.Pkcs.Pkcs9AttributeObject
|
||||
{
|
||||
public Pkcs9DocumentName() { }
|
||||
public Pkcs9DocumentName(byte[] encodedDocumentName) { }
|
||||
public Pkcs9DocumentName(string documentName) { }
|
||||
public string DocumentName { get { throw null; } }
|
||||
public override void CopyFrom(System.Security.Cryptography.AsnEncodedData asnEncodedData) { }
|
||||
}
|
||||
public sealed partial class Pkcs9MessageDigest : System.Security.Cryptography.Pkcs.Pkcs9AttributeObject
|
||||
{
|
||||
public Pkcs9MessageDigest() { }
|
||||
public byte[] MessageDigest { get { throw null; } }
|
||||
public override void CopyFrom(System.Security.Cryptography.AsnEncodedData asnEncodedData) { }
|
||||
}
|
||||
public sealed partial class Pkcs9SigningTime : System.Security.Cryptography.Pkcs.Pkcs9AttributeObject
|
||||
{
|
||||
public Pkcs9SigningTime() { }
|
||||
public Pkcs9SigningTime(byte[] encodedSigningTime) { }
|
||||
public Pkcs9SigningTime(System.DateTime signingTime) { }
|
||||
public System.DateTime SigningTime { get { throw null; } }
|
||||
public override void CopyFrom(System.Security.Cryptography.AsnEncodedData asnEncodedData) { }
|
||||
}
|
||||
public sealed partial class PublicKeyInfo
|
||||
{
|
||||
internal PublicKeyInfo() { }
|
||||
public System.Security.Cryptography.Pkcs.AlgorithmIdentifier Algorithm { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
||||
public byte[] KeyValue { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
||||
}
|
||||
public abstract partial class RecipientInfo
|
||||
{
|
||||
internal RecipientInfo() { }
|
||||
public abstract byte[] EncryptedKey { get; }
|
||||
public abstract System.Security.Cryptography.Pkcs.AlgorithmIdentifier KeyEncryptionAlgorithm { get; }
|
||||
public abstract System.Security.Cryptography.Pkcs.SubjectIdentifier RecipientIdentifier { get; }
|
||||
public System.Security.Cryptography.Pkcs.RecipientInfoType Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
||||
public abstract int Version { get; }
|
||||
}
|
||||
public sealed partial class RecipientInfoCollection : System.Collections.ICollection, System.Collections.IEnumerable
|
||||
{
|
||||
internal RecipientInfoCollection() { }
|
||||
public int Count { get { throw null; } }
|
||||
public System.Security.Cryptography.Pkcs.RecipientInfo this[int index] { get { throw null; } }
|
||||
bool System.Collections.ICollection.IsSynchronized { get { throw null; } }
|
||||
object System.Collections.ICollection.SyncRoot { get { throw null; } }
|
||||
public void CopyTo(System.Array array, int index) { }
|
||||
public void CopyTo(System.Security.Cryptography.Pkcs.RecipientInfo[] array, int index) { }
|
||||
public System.Security.Cryptography.Pkcs.RecipientInfoEnumerator GetEnumerator() { throw null; }
|
||||
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
|
||||
}
|
||||
public sealed partial class RecipientInfoEnumerator : System.Collections.IEnumerator
|
||||
{
|
||||
internal RecipientInfoEnumerator() { }
|
||||
public System.Security.Cryptography.Pkcs.RecipientInfo Current { get { throw null; } }
|
||||
object System.Collections.IEnumerator.Current { get { throw null; } }
|
||||
public bool MoveNext() { throw null; }
|
||||
public void Reset() { }
|
||||
}
|
||||
public enum RecipientInfoType
|
||||
{
|
||||
KeyAgreement = 2,
|
||||
KeyTransport = 1,
|
||||
Unknown = 0,
|
||||
}
|
||||
public sealed partial class SubjectIdentifier
|
||||
{
|
||||
internal SubjectIdentifier() { }
|
||||
public System.Security.Cryptography.Pkcs.SubjectIdentifierType Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
||||
public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
||||
}
|
||||
public sealed partial class SubjectIdentifierOrKey
|
||||
{
|
||||
internal SubjectIdentifierOrKey() { }
|
||||
public System.Security.Cryptography.Pkcs.SubjectIdentifierOrKeyType Type { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
||||
public object Value { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
|
||||
}
|
||||
public enum SubjectIdentifierOrKeyType
|
||||
{
|
||||
IssuerAndSerialNumber = 1,
|
||||
PublicKeyInfo = 3,
|
||||
SubjectKeyIdentifier = 2,
|
||||
Unknown = 0,
|
||||
}
|
||||
public enum SubjectIdentifierType
|
||||
{
|
||||
IssuerAndSerialNumber = 1,
|
||||
NoSignature = 3,
|
||||
SubjectKeyIdentifier = 2,
|
||||
Unknown = 0,
|
||||
}
|
||||
}
|
||||
namespace System.Security.Cryptography.Xml
|
||||
{
|
||||
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
|
||||
public partial struct X509IssuerSerial
|
||||
{
|
||||
public string IssuerName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||
public string SerialNumber { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
|
||||
}
|
||||
}
|
||||
@@ -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">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="System.Security.Cryptography.Pkcs.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
10
external/corefx/src/System.Security.Cryptography.Pkcs/src/Configurations.props
vendored
Normal file
10
external/corefx/src/System.Security.Cryptography.Pkcs/src/Configurations.props
vendored
Normal 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>
|
||||
netstandard-Windows_NT;
|
||||
netstandard-Unix;
|
||||
net46-Windows_NT;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
39
external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/DecryptorPal.cs
vendored
Normal file
39
external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/DecryptorPal.cs
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
// 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.Text;
|
||||
using System.Diagnostics;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography.Pkcs;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
|
||||
namespace Internal.Cryptography
|
||||
{
|
||||
internal abstract class DecryptorPal : IDisposable
|
||||
{
|
||||
internal DecryptorPal(RecipientInfoCollection recipientInfos)
|
||||
{
|
||||
RecipientInfos = recipientInfos;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return the managed representation of the recipients.
|
||||
///
|
||||
/// Desktop compat: Unlike the desktop, we compute this once and then latch it. Since both RecipientInfo and RecipientInfoCollection are immutable objects, this should be
|
||||
/// a safe optimization to make.
|
||||
/// </summary>
|
||||
public RecipientInfoCollection RecipientInfos { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Attempt to decrypt the CMS using the specified "cert". If successful, return the ContentInfo that contains the decrypted content. If unsuccessful, return null and set "exception"
|
||||
/// to a valid Exception object. Do not throw the exception as EnvelopedCms will want to continue decryption attempts against other recipients. Only if all the recipients fail to
|
||||
/// decrypt will then EnvelopedCms throw the exception from the last failed attempt.
|
||||
/// </summary>
|
||||
public abstract ContentInfo TryDecrypt(RecipientInfo recipientInfo, X509Certificate2 cert, X509Certificate2Collection originatorCerts, X509Certificate2Collection extraStore, out Exception exception);
|
||||
|
||||
public abstract void Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
260
external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Helpers.cs
vendored
Normal file
260
external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Helpers.cs
vendored
Normal file
@@ -0,0 +1,260 @@
|
||||
// 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.Text;
|
||||
using System.Diagnostics;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography.Pkcs;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using X509IssuerSerial = System.Security.Cryptography.Xml.X509IssuerSerial;
|
||||
|
||||
namespace Internal.Cryptography
|
||||
{
|
||||
internal static class Helpers
|
||||
{
|
||||
public static byte[] CloneByteArray(this byte[] a)
|
||||
{
|
||||
return (byte[])(a.Clone());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is not just a convenience wrapper for Array.Resize(). In DEBUG builds, it forces the array to move in memory even if no resize is needed. This should be used by
|
||||
/// helper methods that do anything of the form "call a native api once to get the estimated size, call it again to get the data and return the data in a byte[] array."
|
||||
/// Sometimes, that data consist of a native data structure containing pointers to other parts of the block. Using such a helper to retrieve such a block results in an intermittent
|
||||
/// AV. By using this helper, you make that AV repro every time.
|
||||
/// </summary>
|
||||
public static byte[] Resize(this byte[] a, int size)
|
||||
{
|
||||
Array.Resize(ref a, size);
|
||||
#if DEBUG
|
||||
a = a.CloneByteArray();
|
||||
#endif
|
||||
return a;
|
||||
}
|
||||
|
||||
public static CmsRecipientCollection DeepCopy(this CmsRecipientCollection recipients)
|
||||
{
|
||||
CmsRecipientCollection recipientsCopy = new CmsRecipientCollection();
|
||||
foreach (CmsRecipient recipient in recipients)
|
||||
{
|
||||
X509Certificate2 originalCert = recipient.Certificate;
|
||||
X509Certificate2 certCopy = new X509Certificate2(originalCert.Handle);
|
||||
CmsRecipient recipientCopy = new CmsRecipient(recipient.RecipientIdentifierType, certCopy);
|
||||
recipientsCopy.Add(recipientCopy);
|
||||
GC.KeepAlive(originalCert);
|
||||
}
|
||||
return recipientsCopy;
|
||||
}
|
||||
|
||||
public static byte[] UnicodeToOctetString(this string s)
|
||||
{
|
||||
byte[] octets = new byte[2 * (s.Length + 1)];
|
||||
Encoding.Unicode.GetBytes(s, 0, s.Length, octets, 0);
|
||||
return octets;
|
||||
}
|
||||
|
||||
public static string OctetStringToUnicode(this byte[] octets)
|
||||
{
|
||||
if (octets.Length < 2)
|
||||
return string.Empty; // Desktop compat: 0-length byte array maps to string.empty. 1-length byte array gets passed to Marshal.PtrToStringUni() with who knows what outcome.
|
||||
|
||||
string s = Encoding.Unicode.GetString(octets, 0, octets.Length - 2);
|
||||
return s;
|
||||
}
|
||||
|
||||
public static X509Certificate2Collection GetStoreCertificates(StoreName storeName, StoreLocation storeLocation, bool openExistingOnly)
|
||||
{
|
||||
using (X509Store store = new X509Store())
|
||||
{
|
||||
OpenFlags flags = OpenFlags.ReadOnly | OpenFlags.IncludeArchived;
|
||||
if (openExistingOnly)
|
||||
flags |= OpenFlags.OpenExistingOnly;
|
||||
|
||||
store.Open(flags);
|
||||
X509Certificate2Collection certificates = store.Certificates;
|
||||
return certificates;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Desktop compat: We do not complain about multiple matches. Just take the first one and ignore the rest.
|
||||
/// </summary>
|
||||
public static X509Certificate2 TryFindMatchingCertificate(this X509Certificate2Collection certs, SubjectIdentifier recipientIdentifier)
|
||||
{
|
||||
//
|
||||
// Note: SubjectIdentifier has no public constructor so the only one that can construct this type is this assembly.
|
||||
// Therefore, we trust that the string-ized byte array (serial or ski) in it is correct and canonicalized.
|
||||
//
|
||||
|
||||
SubjectIdentifierType recipientIdentifierType = recipientIdentifier.Type;
|
||||
switch (recipientIdentifierType)
|
||||
{
|
||||
case SubjectIdentifierType.IssuerAndSerialNumber:
|
||||
{
|
||||
X509IssuerSerial issuerSerial = (X509IssuerSerial)(recipientIdentifier.Value);
|
||||
byte[] serialNumber = issuerSerial.SerialNumber.ToSerialBytes();
|
||||
string issuer = issuerSerial.IssuerName;
|
||||
foreach (X509Certificate2 candidate in certs)
|
||||
{
|
||||
byte[] candidateSerialNumber = candidate.GetSerialNumber();
|
||||
if (AreByteArraysEqual(candidateSerialNumber, serialNumber) && candidate.Issuer == issuer)
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SubjectIdentifierType.SubjectKeyIdentifier:
|
||||
{
|
||||
string skiString = (string)(recipientIdentifier.Value);
|
||||
byte[] ski = skiString.ToSkiBytes();
|
||||
foreach (X509Certificate2 cert in certs)
|
||||
{
|
||||
byte[] candidateSki = PkcsPal.Instance.GetSubjectKeyIdentifier(cert);
|
||||
if (AreByteArraysEqual(ski, candidateSki))
|
||||
return cert;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// RecipientInfo's can only be created by this package so if this an invalid type, it's the package's fault.
|
||||
Debug.Fail($"Invalid recipientIdentifier type: {recipientIdentifierType}");
|
||||
throw new CryptographicException();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static bool AreByteArraysEqual(byte[] ba1, byte[] ba2)
|
||||
{
|
||||
if (ba1.Length != ba2.Length)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < ba1.Length; i++)
|
||||
{
|
||||
if (ba1[i] != ba2[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asserts on bad or non-canonicalized input. Input must come from trusted sources.
|
||||
///
|
||||
/// Subject Key Identifier is string-ized as an upper case hex string. This format is part of the public api behavior and cannot be changed.
|
||||
/// </summary>
|
||||
private static byte[] ToSkiBytes(this string skiString)
|
||||
{
|
||||
return skiString.UpperHexStringToByteArray();
|
||||
}
|
||||
|
||||
public static string ToSkiString(this byte[] skiBytes)
|
||||
{
|
||||
return skiBytes.ToUpperHexString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asserts on bad or non-canonicalized input. Input must come from trusted sources.
|
||||
///
|
||||
/// Serial number is string-ized as a reversed upper case hex string. This format is part of the public api behavior and cannot be changed.
|
||||
/// </summary>
|
||||
private static byte[] ToSerialBytes(this string serialString)
|
||||
{
|
||||
byte[] ba = serialString.UpperHexStringToByteArray();
|
||||
Array.Reverse(ba);
|
||||
return ba;
|
||||
}
|
||||
|
||||
public static string ToSerialString(this byte[] serialBytes)
|
||||
{
|
||||
serialBytes = serialBytes.CloneByteArray();
|
||||
Array.Reverse(serialBytes);
|
||||
return serialBytes.ToUpperHexString();
|
||||
}
|
||||
|
||||
private static string ToUpperHexString(this byte[] ba)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(ba.Length * 2);
|
||||
foreach (byte b in ba)
|
||||
{
|
||||
sb.Append(b.ToString("X2"));
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asserts on bad input. Input must come from trusted sources.
|
||||
/// </summary>
|
||||
private static byte[] UpperHexStringToByteArray(this string normalizedString)
|
||||
{
|
||||
Debug.Assert((normalizedString.Length & 0x1) == 0);
|
||||
|
||||
byte[] ba = new byte[normalizedString.Length / 2];
|
||||
for (int i = 0; i < ba.Length; i++)
|
||||
{
|
||||
char c = normalizedString[i * 2];
|
||||
byte b = (byte)(UpperHexCharToNybble(c) << 4);
|
||||
c = normalizedString[i * 2 + 1];
|
||||
b |= UpperHexCharToNybble(c);
|
||||
ba[i] = b;
|
||||
}
|
||||
return ba;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Asserts on bad input. Input must come from trusted sources.
|
||||
/// </summary>
|
||||
private static byte UpperHexCharToNybble(char c)
|
||||
{
|
||||
if (c >= '0' && c <= '9')
|
||||
return (byte)(c - '0');
|
||||
if (c >= 'A' && c <= 'F')
|
||||
return (byte)(c - 'A' + 10);
|
||||
|
||||
Debug.Fail($"Invalid hex character: {c}");
|
||||
throw new CryptographicException(); // This just keeps the compiler happy. We don't expect to reach this.
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Useful helper for "upgrading" well-known CMS attributes to type-specific objects such as Pkcs9DocumentName, Pkcs9DocumentDescription, etc.
|
||||
/// </summary>
|
||||
public static Pkcs9AttributeObject CreateBestPkcs9AttributeObjectAvailable(Oid oid, byte[] encodedAttribute)
|
||||
{
|
||||
Pkcs9AttributeObject attributeObject = new Pkcs9AttributeObject(oid, encodedAttribute);
|
||||
switch (oid.Value)
|
||||
{
|
||||
case Oids.DocumentName:
|
||||
attributeObject = Upgrade<Pkcs9DocumentName>(attributeObject);
|
||||
break;
|
||||
|
||||
case Oids.DocumentDescription:
|
||||
attributeObject = Upgrade<Pkcs9DocumentDescription>(attributeObject);
|
||||
break;
|
||||
|
||||
case Oids.SigningTime:
|
||||
attributeObject = Upgrade<Pkcs9SigningTime>(attributeObject);
|
||||
break;
|
||||
|
||||
case Oids.ContentType:
|
||||
attributeObject = Upgrade<Pkcs9ContentType>(attributeObject);
|
||||
break;
|
||||
|
||||
case Oids.MessageDigest:
|
||||
attributeObject = Upgrade<Pkcs9MessageDigest>(attributeObject);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return attributeObject;
|
||||
}
|
||||
|
||||
private static T Upgrade<T>(Pkcs9AttributeObject basicAttribute) where T : Pkcs9AttributeObject, new()
|
||||
{
|
||||
T enhancedAttribute = new T();
|
||||
enhancedAttribute.CopyFrom(basicAttribute);
|
||||
return enhancedAttribute;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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.Text;
|
||||
using System.Diagnostics;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography.Pkcs;
|
||||
|
||||
namespace Internal.Cryptography
|
||||
{
|
||||
internal abstract class KeyAgreeRecipientInfoPal : RecipientInfoPal
|
||||
{
|
||||
internal KeyAgreeRecipientInfoPal()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
public abstract DateTime Date { get; }
|
||||
public abstract SubjectIdentifierOrKey OriginatorIdentifierOrKey { get; }
|
||||
public abstract CryptographicAttributeObject OtherKeyAttribute { get; }
|
||||
}
|
||||
}
|
||||
|
||||
34
external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/KeyLengths.cs
vendored
Normal file
34
external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/KeyLengths.cs
vendored
Normal 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;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Internal.Cryptography
|
||||
{
|
||||
//
|
||||
// These constants enumerate the supported AlgorithmIdentifier.KeyLength values.
|
||||
//
|
||||
// The AlgorithmIdentifier.KeyLength property has one valid use - to specify to the EnvelopedCms constructor which key size to use for RC2 if
|
||||
// you don't want the default (128). In all other cases, it is ignored and is best thought of as an obsolete member.
|
||||
//
|
||||
// DES and 3DES only support one size. AES has separate Oids for various key sizes. ECC has shown that key size isn't even
|
||||
// a valid way to pinpoint an algorithm in the long run.
|
||||
//
|
||||
// The AlgorithmIdentifier you get back from a decoded EnvelopedCms's ContentEncryptionAlgorithm only populates the KeySize
|
||||
// property for RC2/RC4/Des/3DES for backward compatibility. For everything else, it is set to zero and code should not rely on it.
|
||||
//
|
||||
internal static class KeyLengths
|
||||
{
|
||||
public const int Rc2_40Bit = 40;
|
||||
public const int Rc2_56Bit = 56;
|
||||
public const int Rc2_64Bit = 64;
|
||||
public const int Rc2_128Bit = 128;
|
||||
public const int Rc4Max_128Bit = 128;
|
||||
public const int Des_64Bit = 64;
|
||||
public const int TripleDes_192Bit = 192;
|
||||
|
||||
public const int DefaultKeyLengthForRc2AndRc4 = 128;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
// 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.Text;
|
||||
using System.Diagnostics;
|
||||
using System.Security.Cryptography.Pkcs;
|
||||
|
||||
namespace Internal.Cryptography
|
||||
{
|
||||
internal abstract class KeyTransRecipientInfoPal : RecipientInfoPal
|
||||
{
|
||||
internal KeyTransRecipientInfoPal()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
39
external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Oids.cs
vendored
Normal file
39
external/corefx/src/System.Security.Cryptography.Pkcs/src/Internal/Cryptography/Oids.cs
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
// 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.Text;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Internal.Cryptography
|
||||
{
|
||||
internal static class Oids
|
||||
{
|
||||
// Symmetric encryption algorithms
|
||||
public const string TripleDesCbc = "1.2.840.113549.3.7";
|
||||
|
||||
// Asymmetric encryption algorithms
|
||||
public const string Rsa = "1.2.840.113549.1.1.1";
|
||||
public const string Esdh = "1.2.840.113549.1.9.16.3.5";
|
||||
|
||||
// Cryptographic Attribute Types
|
||||
public const string SigningTime = "1.2.840.113549.1.9.5";
|
||||
public const string ContentType = "1.2.840.113549.1.9.3";
|
||||
public const string DocumentDescription = "1.3.6.1.4.1.311.88.2.2";
|
||||
public const string MessageDigest = "1.2.840.113549.1.9.4";
|
||||
public const string DocumentName = "1.3.6.1.4.1.311.88.2.1";
|
||||
|
||||
// Key wrap algorithms
|
||||
public const string CmsRc2Wrap = "1.2.840.113549.1.9.16.3.7";
|
||||
public const string Cms3DesWrap = "1.2.840.113549.1.9.16.3.6";
|
||||
|
||||
// PKCS7 Content Types.
|
||||
public const string Pkcs7Data = "1.2.840.113549.1.7.1";
|
||||
public const string Pkcs7Signed = "1.2.840.113549.1.7.2";
|
||||
public const string Pkcs7Enveloped = "1.2.840.113549.1.7.3";
|
||||
public const string Pkcs7SignedEnveloped = "1.2.840.113549.1.7.4";
|
||||
public const string Pkcs7Hashed = "1.2.840.113549.1.7.5";
|
||||
public const string Pkcs7Encrypted = "1.2.840.113549.1.7.6";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// 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;
|
||||
|
||||
namespace Internal.Cryptography
|
||||
{
|
||||
internal abstract partial class PkcsPal
|
||||
{
|
||||
private static PkcsPal s_instance;
|
||||
|
||||
static PkcsPal()
|
||||
{
|
||||
throw new PlatformNotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// 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;
|
||||
|
||||
namespace Internal.Cryptography.Pal.Windows
|
||||
{
|
||||
internal enum AlgId : int
|
||||
{
|
||||
CALG_RSA_KEYX = 0x0000a400,
|
||||
CALG_DH_SF = 0x0000aa01,
|
||||
CALG_DH_EPHEM = 0x0000aa02,
|
||||
CALG_RC2 = 0x00006602,
|
||||
CALG_RC4 = 0x00006801,
|
||||
CALG_DES = 0x00006601,
|
||||
CALG_3DES = 0x00006603,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
// 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;
|
||||
using System.Security.Cryptography.Pkcs;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
using static Interop.Crypt32;
|
||||
|
||||
namespace Internal.Cryptography.Pal.Windows
|
||||
{
|
||||
internal sealed partial class DecryptorPalWindows : DecryptorPal
|
||||
{
|
||||
internal static DecryptorPalWindows Decode(
|
||||
byte[] encodedMessage,
|
||||
out int version,
|
||||
out ContentInfo contentInfo,
|
||||
out AlgorithmIdentifier contentEncryptionAlgorithm,
|
||||
out X509Certificate2Collection originatorCerts,
|
||||
out CryptographicAttributeObjectCollection unprotectedAttributes
|
||||
)
|
||||
{
|
||||
SafeCryptMsgHandle hCryptMsg = Interop.Crypt32.CryptMsgOpenToDecode(MsgEncodingType.All, 0, 0, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
|
||||
if (hCryptMsg == null || hCryptMsg.IsInvalid)
|
||||
throw Marshal.GetLastWin32Error().ToCryptographicException();
|
||||
|
||||
if (!Interop.Crypt32.CryptMsgUpdate(hCryptMsg, encodedMessage, encodedMessage.Length, fFinal: true))
|
||||
throw Marshal.GetLastWin32Error().ToCryptographicException();
|
||||
|
||||
CryptMsgType cryptMsgType = hCryptMsg.GetMessageType();
|
||||
if (cryptMsgType != CryptMsgType.CMSG_ENVELOPED)
|
||||
throw ErrorCode.CRYPT_E_INVALID_MSG_TYPE.ToCryptographicException();
|
||||
|
||||
version = hCryptMsg.GetVersion();
|
||||
|
||||
contentInfo = hCryptMsg.GetContentInfo();
|
||||
|
||||
using (SafeHandle sh = hCryptMsg.GetMsgParamAsMemory(CryptMsgParamType.CMSG_ENVELOPE_ALGORITHM_PARAM))
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
CRYPT_ALGORITHM_IDENTIFIER* pCryptAlgorithmIdentifier = (CRYPT_ALGORITHM_IDENTIFIER*)(sh.DangerousGetHandle());
|
||||
contentEncryptionAlgorithm = (*pCryptAlgorithmIdentifier).ToAlgorithmIdentifier();
|
||||
}
|
||||
}
|
||||
|
||||
originatorCerts = hCryptMsg.GetOriginatorCerts();
|
||||
unprotectedAttributes = hCryptMsg.GetUnprotectedAttributes();
|
||||
|
||||
RecipientInfoCollection recipientInfos = CreateRecipientInfos(hCryptMsg);
|
||||
return new DecryptorPalWindows(hCryptMsg, recipientInfos);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// 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.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography.Pkcs;
|
||||
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
using static Interop.Crypt32;
|
||||
|
||||
namespace Internal.Cryptography.Pal.Windows
|
||||
{
|
||||
internal sealed partial class DecryptorPalWindows : DecryptorPal
|
||||
{
|
||||
private static RecipientInfoCollection CreateRecipientInfos(SafeCryptMsgHandle hCryptMsg)
|
||||
{
|
||||
int numRecipients;
|
||||
int cbRecipientsCount = sizeof(int);
|
||||
if (!Interop.Crypt32.CryptMsgGetParam(hCryptMsg, CryptMsgParamType.CMSG_CMS_RECIPIENT_COUNT_PARAM, 0, out numRecipients, ref cbRecipientsCount))
|
||||
throw Marshal.GetLastWin32Error().ToCryptographicException();
|
||||
|
||||
List<RecipientInfo> recipientInfos = new List<RecipientInfo>(numRecipients);
|
||||
for (int index = 0; index < numRecipients; index++)
|
||||
{
|
||||
// Do not dispose this safehandle. The RecipientInfoPal objects we create hold on to these and they get freed through garbage collection.
|
||||
SafeHandle pCmsgCmsRecipientInfoMemory = hCryptMsg.GetMsgParamAsMemory(CryptMsgParamType.CMSG_CMS_RECIPIENT_INFO_PARAM, index);
|
||||
IEnumerable<RecipientInfo> recipientInfosForThisIndex = ToRecipientInfosForThisIndex(pCmsgCmsRecipientInfoMemory, index);
|
||||
recipientInfos.AddRange(recipientInfosForThisIndex);
|
||||
}
|
||||
|
||||
return new RecipientInfoCollection(recipientInfos);
|
||||
}
|
||||
|
||||
private static IEnumerable<RecipientInfo> ToRecipientInfosForThisIndex(SafeHandle pCmsgCmsRecipientInfoMemory, int index)
|
||||
{
|
||||
bool mustRelease = false;
|
||||
pCmsgCmsRecipientInfoMemory.DangerousAddRef(ref mustRelease);
|
||||
try
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
CMSG_CMS_RECIPIENT_INFO* pCMsgCmsRecipientInfo = (CMSG_CMS_RECIPIENT_INFO*)(pCmsgCmsRecipientInfoMemory.DangerousGetHandle());
|
||||
switch (pCMsgCmsRecipientInfo->dwRecipientChoice)
|
||||
{
|
||||
case CMsgCmsRecipientChoice.CMSG_KEY_TRANS_RECIPIENT:
|
||||
return new KeyTransRecipientInfo[] { new KeyTransRecipientInfo(new KeyTransRecipientInfoPalWindows(pCmsgCmsRecipientInfoMemory, index)) };
|
||||
|
||||
case CMsgCmsRecipientChoice.CMSG_KEY_AGREE_RECIPIENT:
|
||||
{
|
||||
CMSG_KEY_AGREE_RECIPIENT_INFO* pCmsKeyAgreeRecipientInfo = pCMsgCmsRecipientInfo->KeyAgree;
|
||||
int numKeys = pCmsKeyAgreeRecipientInfo->cRecipientEncryptedKeys;
|
||||
KeyAgreeRecipientInfo[] recipients = new KeyAgreeRecipientInfo[numKeys];
|
||||
for (int subIndex = 0; subIndex < numKeys; subIndex++)
|
||||
{
|
||||
recipients[subIndex] = new KeyAgreeRecipientInfo(new KeyAgreeRecipientInfoPalWindows(pCmsgCmsRecipientInfoMemory, index, subIndex));
|
||||
}
|
||||
return recipients;
|
||||
}
|
||||
|
||||
default:
|
||||
throw ErrorCode.E_NOTIMPL.ToCryptographicException();
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (mustRelease)
|
||||
{
|
||||
pCmsgCmsRecipientInfoMemory.DangerousRelease();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,250 @@
|
||||
// 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;
|
||||
using System.Security.Cryptography.Pkcs;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
using static Interop.Crypt32;
|
||||
|
||||
namespace Internal.Cryptography.Pal.Windows
|
||||
{
|
||||
internal sealed partial class DecryptorPalWindows : DecryptorPal
|
||||
{
|
||||
public sealed override ContentInfo TryDecrypt(RecipientInfo recipientInfo, X509Certificate2 cert, X509Certificate2Collection originatorCerts, X509Certificate2Collection extraStore, out Exception exception)
|
||||
{
|
||||
Debug.Assert(recipientInfo != null);
|
||||
Debug.Assert(cert != null);
|
||||
Debug.Assert(originatorCerts != null);
|
||||
Debug.Assert(extraStore != null);
|
||||
|
||||
CryptKeySpec keySpec;
|
||||
exception = TryGetKeySpecForCertificate(cert, out keySpec);
|
||||
if (exception != null)
|
||||
return null;
|
||||
|
||||
// Desktop compat: We pass false for "silent" here (thus allowing crypto providers to display UI.)
|
||||
using (SafeProvOrNCryptKeyHandle hKey = TryGetCertificatePrivateKey(cert, false, out exception))
|
||||
{
|
||||
if (hKey == null)
|
||||
return null;
|
||||
|
||||
RecipientInfoType type = recipientInfo.Type;
|
||||
switch (type)
|
||||
{
|
||||
case RecipientInfoType.KeyTransport:
|
||||
exception = TryDecryptTrans((KeyTransRecipientInfo)recipientInfo, hKey, keySpec);
|
||||
break;
|
||||
|
||||
case RecipientInfoType.KeyAgreement:
|
||||
exception = TryDecryptAgree((KeyAgreeRecipientInfo)recipientInfo, hKey, keySpec, originatorCerts, extraStore);
|
||||
break;
|
||||
|
||||
default:
|
||||
// Since only the framework can construct RecipientInfo's, we're at fault if we get here. So it's okay to assert and throw rather than
|
||||
// returning to the caller.
|
||||
Debug.Fail($"Unexpected RecipientInfoType: {type}");
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
if (exception != null)
|
||||
return null;
|
||||
|
||||
// If we got here, we successfully decrypted. Return the decrypted content.
|
||||
return _hCryptMsg.GetContentInfo();
|
||||
}
|
||||
}
|
||||
|
||||
private static Exception TryGetKeySpecForCertificate(X509Certificate2 cert, out CryptKeySpec keySpec)
|
||||
{
|
||||
using (SafeCertContextHandle hCertContext = cert.CreateCertContextHandle())
|
||||
{
|
||||
int cbSize = 0;
|
||||
|
||||
if (Interop.Crypt32.CertGetCertificateContextProperty(
|
||||
hCertContext,
|
||||
CertContextPropId.CERT_NCRYPT_KEY_HANDLE_PROP_ID,
|
||||
null,
|
||||
ref cbSize))
|
||||
{
|
||||
keySpec = CryptKeySpec.CERT_NCRYPT_KEY_SPEC;
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!Interop.Crypt32.CertGetCertificateContextProperty(hCertContext, CertContextPropId.CERT_KEY_PROV_INFO_PROP_ID, null, ref cbSize))
|
||||
{
|
||||
ErrorCode errorCode = (ErrorCode)(Marshal.GetLastWin32Error());
|
||||
keySpec = default(CryptKeySpec);
|
||||
return errorCode.ToCryptographicException();
|
||||
}
|
||||
|
||||
byte[] pData = new byte[cbSize];
|
||||
unsafe
|
||||
{
|
||||
fixed (byte* pvData = pData)
|
||||
{
|
||||
if (!Interop.Crypt32.CertGetCertificateContextProperty(hCertContext, CertContextPropId.CERT_KEY_PROV_INFO_PROP_ID, pData, ref cbSize))
|
||||
{
|
||||
ErrorCode errorCode = (ErrorCode)(Marshal.GetLastWin32Error());
|
||||
keySpec = default(CryptKeySpec);
|
||||
return errorCode.ToCryptographicException();
|
||||
}
|
||||
|
||||
CRYPT_KEY_PROV_INFO* pCryptKeyProvInfo = (CRYPT_KEY_PROV_INFO*)pvData;
|
||||
keySpec = pCryptKeyProvInfo->dwKeySpec;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static SafeProvOrNCryptKeyHandle TryGetCertificatePrivateKey(X509Certificate2 cert, bool silent, out Exception exception)
|
||||
{
|
||||
CryptAcquireCertificatePrivateKeyFlags flags =
|
||||
CryptAcquireCertificatePrivateKeyFlags.CRYPT_ACQUIRE_USE_PROV_INFO_FLAG
|
||||
| CryptAcquireCertificatePrivateKeyFlags.CRYPT_ACQUIRE_COMPARE_KEY_FLAG
|
||||
// Note: Using CRYPT_ACQUIRE_ALLOW_NCRYPT_KEY_FLAG rather than CRYPT_ACQUIRE_PREFER_NCRYPT_KEY_FLAG because wrapping an NCrypt wrapper over CAPI keys unconditionally
|
||||
// causes some legacy features (such as RC4 support) to break.
|
||||
| CryptAcquireCertificatePrivateKeyFlags.CRYPT_ACQUIRE_ALLOW_NCRYPT_KEY_FLAG;
|
||||
if (silent)
|
||||
{
|
||||
flags |= CryptAcquireCertificatePrivateKeyFlags.CRYPT_ACQUIRE_SILENT_FLAG;
|
||||
}
|
||||
|
||||
bool mustFree;
|
||||
using (SafeCertContextHandle hCertContext = cert.CreateCertContextHandle())
|
||||
{
|
||||
IntPtr hKey;
|
||||
int cbSize = IntPtr.Size;
|
||||
|
||||
if (Interop.Crypt32.CertGetCertificateContextProperty(
|
||||
hCertContext,
|
||||
CertContextPropId.CERT_NCRYPT_KEY_HANDLE_PROP_ID,
|
||||
out hKey,
|
||||
ref cbSize))
|
||||
{
|
||||
exception = null;
|
||||
return new SafeProvOrNCryptKeyHandleUwp(hKey, hCertContext);
|
||||
}
|
||||
|
||||
CryptKeySpec keySpec;
|
||||
|
||||
if (!Interop.Crypt32.CryptAcquireCertificatePrivateKey(hCertContext, flags, IntPtr.Zero, out hKey, out keySpec, out mustFree))
|
||||
{
|
||||
exception = Marshal.GetHRForLastWin32Error().ToCryptographicException();
|
||||
return null;
|
||||
}
|
||||
|
||||
// We need to know whether we got back a CRYPTPROV or NCrypt handle. Unfortunately, NCryptIsKeyHandle() is a prohibited api on UWP.
|
||||
// Fortunately, CryptAcquireCertificatePrivateKey() is documented to tell us which one we got through the keySpec value.
|
||||
bool isNCrypt;
|
||||
switch (keySpec)
|
||||
{
|
||||
case CryptKeySpec.AT_KEYEXCHANGE:
|
||||
case CryptKeySpec.AT_SIGNATURE:
|
||||
isNCrypt = false;
|
||||
break;
|
||||
|
||||
case CryptKeySpec.CERT_NCRYPT_KEY_SPEC:
|
||||
isNCrypt = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
// As of this writing, we've exhausted all the known values of keySpec. We have no idea what kind of key handle we got so
|
||||
// play it safe and fail fast.
|
||||
throw new NotSupportedException(SR.Format(SR.Cryptography_Cms_UnknownKeySpec, keySpec));
|
||||
}
|
||||
|
||||
SafeProvOrNCryptKeyHandleUwp hProvOrNCryptKey = new SafeProvOrNCryptKeyHandleUwp(hKey, ownsHandle: mustFree, isNcrypt: isNCrypt);
|
||||
exception = null;
|
||||
return hProvOrNCryptKey;
|
||||
}
|
||||
}
|
||||
|
||||
private Exception TryDecryptTrans(KeyTransRecipientInfo recipientInfo, SafeProvOrNCryptKeyHandle hKey, CryptKeySpec keySpec)
|
||||
{
|
||||
KeyTransRecipientInfoPalWindows pal = (KeyTransRecipientInfoPalWindows)(recipientInfo.Pal);
|
||||
|
||||
CMSG_CTRL_DECRYPT_PARA decryptPara;
|
||||
decryptPara.cbSize = Marshal.SizeOf<CMSG_CTRL_DECRYPT_PARA>();
|
||||
decryptPara.hKey = hKey;
|
||||
decryptPara.dwKeySpec = keySpec;
|
||||
decryptPara.dwRecipientIndex = pal.Index;
|
||||
|
||||
bool success = Interop.Crypt32.CryptMsgControl(_hCryptMsg, 0, MsgControlType.CMSG_CTRL_DECRYPT, ref decryptPara);
|
||||
if (!success)
|
||||
return Marshal.GetHRForLastWin32Error().ToCryptographicException();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Exception TryDecryptAgree(KeyAgreeRecipientInfo keyAgreeRecipientInfo, SafeProvOrNCryptKeyHandle hKey, CryptKeySpec keySpec, X509Certificate2Collection originatorCerts, X509Certificate2Collection extraStore)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
KeyAgreeRecipientInfoPalWindows pal = (KeyAgreeRecipientInfoPalWindows)(keyAgreeRecipientInfo.Pal);
|
||||
return pal.WithCmsgCmsRecipientInfo<Exception>(
|
||||
delegate (CMSG_KEY_AGREE_RECIPIENT_INFO* pKeyAgreeRecipientInfo)
|
||||
{
|
||||
CMSG_CTRL_KEY_AGREE_DECRYPT_PARA decryptPara = default(CMSG_CTRL_KEY_AGREE_DECRYPT_PARA);
|
||||
decryptPara.cbSize = Marshal.SizeOf<CMSG_CTRL_KEY_AGREE_DECRYPT_PARA>();
|
||||
decryptPara.hProv = hKey;
|
||||
decryptPara.dwKeySpec = keySpec;
|
||||
decryptPara.pKeyAgree = pKeyAgreeRecipientInfo;
|
||||
decryptPara.dwRecipientIndex = pal.Index;
|
||||
decryptPara.dwRecipientEncryptedKeyIndex = pal.SubIndex;
|
||||
CMsgKeyAgreeOriginatorChoice originatorChoice = pKeyAgreeRecipientInfo->dwOriginatorChoice;
|
||||
switch (originatorChoice)
|
||||
{
|
||||
case CMsgKeyAgreeOriginatorChoice.CMSG_KEY_AGREE_ORIGINATOR_CERT:
|
||||
{
|
||||
X509Certificate2Collection candidateCerts = new X509Certificate2Collection();
|
||||
candidateCerts.AddRange(Helpers.GetStoreCertificates(StoreName.AddressBook, StoreLocation.CurrentUser, openExistingOnly: true));
|
||||
candidateCerts.AddRange(Helpers.GetStoreCertificates(StoreName.AddressBook, StoreLocation.LocalMachine, openExistingOnly: true));
|
||||
candidateCerts.AddRange(originatorCerts);
|
||||
candidateCerts.AddRange(extraStore);
|
||||
SubjectIdentifier originatorId = pKeyAgreeRecipientInfo->OriginatorCertId.ToSubjectIdentifier();
|
||||
X509Certificate2 originatorCert = candidateCerts.TryFindMatchingCertificate(originatorId);
|
||||
if (originatorCert == null)
|
||||
return ErrorCode.CRYPT_E_NOT_FOUND.ToCryptographicException();
|
||||
using (SafeCertContextHandle hCertContext = originatorCert.CreateCertContextHandle())
|
||||
{
|
||||
CERT_CONTEXT* pOriginatorCertContext = hCertContext.DangerousGetCertContext();
|
||||
decryptPara.OriginatorPublicKey = pOriginatorCertContext->pCertInfo->SubjectPublicKeyInfo.PublicKey;
|
||||
|
||||
// Do not factor this call out of the switch statement as leaving this "using" block will free up
|
||||
// native memory that decryptPara points to.
|
||||
return TryExecuteDecryptAgree(ref decryptPara);
|
||||
}
|
||||
}
|
||||
|
||||
case CMsgKeyAgreeOriginatorChoice.CMSG_KEY_AGREE_ORIGINATOR_PUBLIC_KEY:
|
||||
{
|
||||
decryptPara.OriginatorPublicKey = pKeyAgreeRecipientInfo->OriginatorPublicKeyInfo.PublicKey;
|
||||
return TryExecuteDecryptAgree(ref decryptPara);
|
||||
}
|
||||
|
||||
default:
|
||||
return new CryptographicException(SR.Format(SR.Cryptography_Cms_Invalid_Originator_Identifier_Choice, originatorChoice));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private Exception TryExecuteDecryptAgree(ref CMSG_CTRL_KEY_AGREE_DECRYPT_PARA decryptPara)
|
||||
{
|
||||
if (!Interop.Crypt32.CryptMsgControl(_hCryptMsg, 0, MsgControlType.CMSG_CTRL_KEY_AGREE_DECRYPT, ref decryptPara))
|
||||
{
|
||||
ErrorCode errorCode = (ErrorCode)(Marshal.GetHRForLastWin32Error());
|
||||
return errorCode.ToCryptographicException();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// 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.Pkcs;
|
||||
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace Internal.Cryptography.Pal.Windows
|
||||
{
|
||||
internal sealed partial class DecryptorPalWindows : DecryptorPal
|
||||
{
|
||||
private DecryptorPalWindows(SafeCryptMsgHandle hCryptMsg, RecipientInfoCollection recipientInfos)
|
||||
: base(recipientInfos)
|
||||
{
|
||||
_hCryptMsg = hCryptMsg;
|
||||
}
|
||||
|
||||
public sealed override void Dispose()
|
||||
{
|
||||
if (_hCryptMsg != null && !_hCryptMsg.IsInvalid)
|
||||
{
|
||||
_hCryptMsg.Dispose();
|
||||
_hCryptMsg = null;
|
||||
}
|
||||
}
|
||||
|
||||
private SafeCryptMsgHandle _hCryptMsg;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user