Imported Upstream version 5.4.0.167

Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-08-21 15:34:15 +00:00
parent e49d6f06c0
commit 536cd135cc
12856 changed files with 563812 additions and 223249 deletions

View File

@@ -26,18 +26,18 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4A85232C-E914-4E06-8542-26DAF4B22D60}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU
{4A85232C-E914-4E06-8542-26DAF4B22D60}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU
{4A85232C-E914-4E06-8542-26DAF4B22D60}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU
{4A85232C-E914-4E06-8542-26DAF4B22D60}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU
{0544EAE3-0CF2-4EA6-93BE-A9FF8B52724A}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU
{0544EAE3-0CF2-4EA6-93BE-A9FF8B52724A}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU
{0544EAE3-0CF2-4EA6-93BE-A9FF8B52724A}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU
{0544EAE3-0CF2-4EA6-93BE-A9FF8B52724A}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU
{C7266957-DB20-4250-9C2E-E1FF83EDBD71}.Debug|Any CPU.ActiveCfg = netcoreapp-Debug|Any CPU
{C7266957-DB20-4250-9C2E-E1FF83EDBD71}.Debug|Any CPU.Build.0 = netcoreapp-Debug|Any CPU
{C7266957-DB20-4250-9C2E-E1FF83EDBD71}.Release|Any CPU.ActiveCfg = netcoreapp-Release|Any CPU
{C7266957-DB20-4250-9C2E-E1FF83EDBD71}.Release|Any CPU.Build.0 = netcoreapp-Release|Any CPU
{4A85232C-E914-4E06-8542-26DAF4B22D60}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU
{4A85232C-E914-4E06-8542-26DAF4B22D60}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU
{4A85232C-E914-4E06-8542-26DAF4B22D60}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU
{4A85232C-E914-4E06-8542-26DAF4B22D60}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU
{0544EAE3-0CF2-4EA6-93BE-A9FF8B52724A}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU
{0544EAE3-0CF2-4EA6-93BE-A9FF8B52724A}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU
{0544EAE3-0CF2-4EA6-93BE-A9FF8B52724A}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU
{0544EAE3-0CF2-4EA6-93BE-A9FF8B52724A}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU
{C7266957-DB20-4250-9C2E-E1FF83EDBD71}.Debug|Any CPU.ActiveCfg = netstandard-Debug|Any CPU
{C7266957-DB20-4250-9C2E-E1FF83EDBD71}.Debug|Any CPU.Build.0 = netstandard-Debug|Any CPU
{C7266957-DB20-4250-9C2E-E1FF83EDBD71}.Release|Any CPU.ActiveCfg = netstandard-Release|Any CPU
{C7266957-DB20-4250-9C2E-E1FF83EDBD71}.Release|Any CPU.Build.0 = netstandard-Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -2,6 +2,7 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />
<PropertyGroup>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
<AssemblyKey>Open</AssemblyKey>
</PropertyGroup>
</Project>

View File

@@ -3,17 +3,9 @@
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\ref\System.Security.Cryptography.Xml.csproj">
<SupportedFramework>net462;netcoreapp2.0;$(AllXamarinFrameworks)</SupportedFramework>
<SupportedFramework>net461;netcoreapp2.0;$(AllXamarinFrameworks)</SupportedFramework>
</ProjectReference>
<ProjectReference Include="..\src\System.Security.Cryptography.Xml.csproj" />
</ItemGroup>
<ItemGroup>
<InboxOnTargetFramework Include="MonoAndroid10" />
<InboxOnTargetFramework Include="MonoTouch10" />
<InboxOnTargetFramework Include="xamarinios10" />
<InboxOnTargetFramework Include="xamarinmac20" />
<InboxOnTargetFramework Include="xamarintvos10" />
<InboxOnTargetFramework Include="xamarinwatchos10" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -2,8 +2,8 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netcoreapp;
uap;
netstandard;
netfx
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -362,13 +362,7 @@ namespace System.Security.Cryptography.Xml
public const string XmlDsigMinimalCanonicalizationUrl = "http://www.w3.org/2000/09/xmldsig#minimal";
public const string XmlDsigNamespaceUrl = "http://www.w3.org/2000/09/xmldsig#";
public const string XmlDsigRSASHA1Url = "http://www.w3.org/2000/09/xmldsig#rsa-sha1";
public const string XmlDsigRSASHA256Url = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256";
public const string XmlDsigRSASHA384Url = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384";
public const string XmlDsigRSASHA512Url = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512";
public const string XmlDsigSHA1Url = "http://www.w3.org/2000/09/xmldsig#sha1";
public const string XmlDsigSHA256Url = "http://www.w3.org/2001/04/xmlenc#sha256";
public const string XmlDsigSHA384Url = "http://www.w3.org/2001/04/xmldsig-more#sha384";
public const string XmlDsigSHA512Url = "http://www.w3.org/2001/04/xmlenc#sha512";
public const string XmlDsigXPathTransformUrl = "http://www.w3.org/TR/1999/REC-xpath-19991116";
public const string XmlDsigXsltTransformUrl = "http://www.w3.org/TR/1999/REC-xslt-19991116";
public const string XmlLicenseTransformUrl = "urn:mpeg:mpeg21:2003:01-REL-R-NS:licenseTransform";

View File

@@ -1,21 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<ProjectGuid>{C7266957-DB20-4250-9C2E-E1FF83EDBD71}</ProjectGuid>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'netfx'">true</IsPartialFacadeAssembly>
</PropertyGroup>
<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'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' == 'true'">
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="System.Security" />
</ItemGroup>
<ItemGroup>
<Compile Include="System.Security.Cryptography.Xml.cs" />
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
<ProjectReference Include="..\..\System.Runtime.Extensions\ref\System.Runtime.Extensions.csproj" />
<ProjectReference Include="..\..\System.Security.Cryptography.Algorithms\ref\System.Security.Cryptography.Algorithms.csproj" />
<ProjectReference Include="..\..\System.Security.Cryptography.Primitives\ref\System.Security.Cryptography.Primitives.csproj" />
<ProjectReference Include="..\..\System.Security.Cryptography.X509Certificates\ref\System.Security.Cryptography.X509Certificates.csproj" />
<ProjectReference Include="..\..\System.Xml.ReaderWriter\ref\System.Xml.ReaderWriter.csproj" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
</Project>

View File

@@ -2,7 +2,8 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netcoreapp
netstandard;
netfx
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -1,5 +1,64 @@
<?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">
@@ -109,6 +168,9 @@
<data name="Cryptography_Xml_InvalidSignatureLength2" xml:space="preserve">
<value>The length in bits of the signature with a MAC should be a multiple of 8.</value>
</data>
<data name="Cryptography_Xml_InvalidX509IssuerSerialNumber" xml:space="preserve">
<value>X509 issuer serial number is invalid.</value>
</data>
<data name="Cryptography_Xml_KeyInfoRequired" xml:space="preserve">
<value>A KeyInfo element is required to check the signature.</value>
</data>

View File

@@ -5,10 +5,12 @@
<AssemblyName>System.Security.Cryptography.Xml</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ProjectGuid>{0544EAE3-0CF2-4EA6-93BE-A9FF8B52724A}</ProjectGuid>
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' != 'netstandard'">true</IsPartialFacadeAssembly>
</PropertyGroup>
<!-- Help VS understand available configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true'">
<Compile Include="System\Security\Cryptography\Xml\AncestralNamespaceContextManager.cs" />
<Compile Include="System\Security\Cryptography\Xml\AttributeSortOrder.cs" />
@@ -83,9 +85,13 @@
<Compile Include="System\Security\Cryptography\Xml\XmlDsigXsltTransform.cs" />
<Compile Include="System\Security\Cryptography\Xml\XmlLicenseTransform.cs" />
<Compile Include="System\Security\Cryptography\Xml\CryptoHelpers.cs" />
<Compile Include="System\Security\Cryptography\Xml\RSAPKCS1SignatureDescription.cs" />
<Compile Include="System\Security\Cryptography\Xml\RSAPKCS1SHA1SignatureDescription.cs" />
<Compile Include="System\Security\Cryptography\Xml\RSAPKCS1SHA256SignatureDescription.cs" />
<Compile Include="System\Security\Cryptography\Xml\RSAPKCS1SHA512SignatureDescription.cs" />
<Compile Include="System\Security\Cryptography\Xml\RSAPKCS1SHA384SignatureDescription.cs" />
</ItemGroup>
<ItemGroup>
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true'">
<Reference Include="System.Collections" />
<Reference Include="System.Collections.NonGeneric" />
<Reference Include="System.Diagnostics.Debug" />
@@ -105,5 +111,10 @@
<Reference Include="System.Xml.ReaderWriter" />
<Reference Include="System.Xml.XPath" />
</ItemGroup>
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' == 'true'">
<Reference Include="mscorlib" />
<Reference Include="System" />
<Reference Include="System.Security" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -1,4 +1,4 @@
// Licensed to the .NET Foundation under one or more agreements.
// 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.
@@ -16,7 +16,6 @@ using System.Xml;
namespace System.Security.Cryptography.Xml
{
[Serializable]
internal enum CertUsageType
{
Verification = 0,

View File

@@ -13,6 +13,7 @@ namespace System.Security.Cryptography.Xml
internal static class CryptoHelpers
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5350", Justification = "SHA1 needed for compat.")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5351", Justification = "HMACMD5 needed for compat.")]
public static object CreateFromName(string name)
{
switch (name)
@@ -49,33 +50,31 @@ namespace System.Security.Cryptography.Xml
return new KeyInfoRetrievalMethod();
case "http://www.w3.org/2001/04/xmlenc# EncryptedKey":
return new KeyInfoEncryptedKey();
case "http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160":
throw new NotImplementedException(name);
//return new System.Security.Cryptography.HMACRIPEMD160();
case "http://www.w3.org/2000/09/xmldsig#dsa-sha1":
return new DSASignatureDescription();
case "System.Security.Cryptography.DSASignatureDescription":
throw new NotImplementedException(name);
//return new DSASignatureDescription();
return new DSASignatureDescription();
case "http://www.w3.org/2000/09/xmldsig#rsa-sha1":
return new RSAPKCS1SHA1SignatureDescription();
case "System.Security.Cryptography.RSASignatureDescription":
throw new NotImplementedException(name);
//return new RSAPKCS1SHA1SignatureDescription();
return new RSAPKCS1SHA1SignatureDescription();
case "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256":
throw new NotImplementedException(name);
//return new RSAPKCS1SHA256SignatureDescription();
return new RSAPKCS1SHA256SignatureDescription();
case "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384":
throw new NotImplementedException(name);
//return new RSAPKCS1SHA384SignatureDescription();
return new RSAPKCS1SHA384SignatureDescription();
case "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512":
throw new NotImplementedException(name);
//return new RSAPKCS1SHA512SignatureDescription();
return new RSAPKCS1SHA512SignatureDescription();
// workarounds for issue https://github.com/dotnet/corefx/issues/16563
// remove attribute from this method when removing them
case "http://www.w3.org/2000/09/xmldsig#sha1":
return SHA1.Create();
case "MD5":
return MD5.Create();
case "http://www.w3.org/2001/04/xmldsig-more#hmac-md5":
return new HMACMD5();
case "http://www.w3.org/2001/04/xmlenc#tripledes-cbc":
return TripleDES.Create();
}
return CryptoConfig.CreateFromName(name);

View File

@@ -23,6 +23,8 @@ namespace System.Security.Cryptography.Xml
// exception propagates from a remoting server to the client.
protected CryptoSignedXmlRecursionException(System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context)
{ }
{
throw new PlatformNotSupportedException();
}
}
}

View File

@@ -39,7 +39,7 @@ namespace System.Security.Cryptography.Xml
set
{
if (value <= 0)
throw new ArgumentOutOfRangeException(SR.Cryptography_Xml_InvalidKeySize);
throw new ArgumentOutOfRangeException(nameof(value), SR.Cryptography_Xml_InvalidKeySize);
_keySize = value;
_cachedXml = null;
}

View File

@@ -148,7 +148,6 @@ namespace System.Security.Cryptography.Xml
}
}
/// <internalonly/>
public void CopyTo(Array array, int index)
{
_props.CopyTo(array, index);

View File

@@ -155,7 +155,16 @@ namespace System.Security.Cryptography.Xml
public void AddIssuerSerial(string issuerName, string serialNumber)
{
BigInteger h = BigInteger.Parse(serialNumber, NumberStyles.AllowHexSpecifier);
if (string.IsNullOrEmpty(issuerName))
throw new ArgumentException(SR.Arg_EmptyOrNullString, nameof(issuerName));
if (string.IsNullOrEmpty(serialNumber))
throw new ArgumentException(SR.Arg_EmptyOrNullString, nameof(serialNumber));
BigInteger h;
if (!BigInteger.TryParse(serialNumber, NumberStyles.AllowHexSpecifier, NumberFormatInfo.CurrentInfo, out h))
throw new ArgumentException(SR.Cryptography_Xml_InvalidX509IssuerSerialNumber, nameof(serialNumber));
if (_issuerSerials == null)
_issuerSerials = new ArrayList();
_issuerSerials.Add(new X509IssuerSerial(issuerName, h.ToString()));

View File

@@ -10,32 +10,10 @@ using System.Threading.Tasks;
namespace System.Security.Cryptography.Xml
{
internal class RSAPKCS1SHA1SignatureDescription : SignatureDescription
internal class RSAPKCS1SHA1SignatureDescription : RSAPKCS1SignatureDescription
{
const string HashAlgorithm = "SHA1";
public RSAPKCS1SHA1SignatureDescription()
public RSAPKCS1SHA1SignatureDescription() : base("SHA1")
{
KeyAlgorithm = typeof(System.Security.Cryptography.RSA).AssemblyQualifiedName;
FormatterAlgorithm = typeof(System.Security.Cryptography.RSAPKCS1SignatureFormatter).AssemblyQualifiedName;
DeformatterAlgorithm = typeof(System.Security.Cryptography.RSAPKCS1SignatureDeformatter).AssemblyQualifiedName;
DigestAlgorithm = "SHA1";
}
public sealed override AsymmetricSignatureDeformatter CreateDeformatter(AsymmetricAlgorithm key)
{
var item = (AsymmetricSignatureDeformatter)CryptoHelpers.CreateFromName(DeformatterAlgorithm);
item.SetKey(key);
item.SetHashAlgorithm(HashAlgorithm);
return item;
}
public sealed override AsymmetricSignatureFormatter CreateFormatter(AsymmetricAlgorithm key)
{
var item = (AsymmetricSignatureFormatter)CryptoHelpers.CreateFromName(FormatterAlgorithm);
item.SetKey(key);
item.SetHashAlgorithm(HashAlgorithm);
return item;
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA5350", Justification = "SHA1 needed for compat.")]

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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Security.Cryptography.Xml
{
internal class RSAPKCS1SHA256SignatureDescription : RSAPKCS1SignatureDescription
{
public RSAPKCS1SHA256SignatureDescription() : base("SHA256")
{
}
public sealed override HashAlgorithm CreateDigest()
{
return SHA256.Create();
}
}
}

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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Security.Cryptography.Xml
{
internal class RSAPKCS1SHA384SignatureDescription : RSAPKCS1SignatureDescription
{
public RSAPKCS1SHA384SignatureDescription() : base("SHA384")
{
}
public sealed override HashAlgorithm CreateDigest()
{
return SHA384.Create();
}
}
}

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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Security.Cryptography.Xml
{
internal class RSAPKCS1SHA512SignatureDescription : RSAPKCS1SignatureDescription
{
public RSAPKCS1SHA512SignatureDescription() : base("SHA512")
{
}
public sealed override HashAlgorithm CreateDigest()
{
return SHA512.Create();
}
}
}

View File

@@ -0,0 +1,41 @@
// 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.Linq;
using System.Text;
using System.Threading.Tasks;
namespace System.Security.Cryptography.Xml
{
internal abstract class RSAPKCS1SignatureDescription : SignatureDescription
{
public RSAPKCS1SignatureDescription(string hashAlgorithmName)
{
KeyAlgorithm = typeof(System.Security.Cryptography.RSA).AssemblyQualifiedName;
FormatterAlgorithm = typeof(System.Security.Cryptography.RSAPKCS1SignatureFormatter).AssemblyQualifiedName;
DeformatterAlgorithm = typeof(System.Security.Cryptography.RSAPKCS1SignatureDeformatter).AssemblyQualifiedName;
DigestAlgorithm = hashAlgorithmName;
}
public sealed override AsymmetricSignatureDeformatter CreateDeformatter(AsymmetricAlgorithm key)
{
var item = (AsymmetricSignatureDeformatter)CryptoHelpers.CreateFromName(DeformatterAlgorithm);
item.SetKey(key);
item.SetHashAlgorithm(DigestAlgorithm);
return item;
}
public sealed override AsymmetricSignatureFormatter CreateFormatter(AsymmetricAlgorithm key)
{
var item = (AsymmetricSignatureFormatter)CryptoHelpers.CreateFromName(FormatterAlgorithm);
item.SetKey(key);
item.SetHashAlgorithm(DigestAlgorithm);
return item;
}
public abstract override HashAlgorithm CreateDigest();
}
}

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