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
25
external/corefx/src/System.Security.Cryptography.Xml/System.Security.Cryptography.Xml.sln
vendored
Normal file
25
external/corefx/src/System.Security.Cryptography.Xml/System.Security.Cryptography.Xml.sln
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
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.Xml.Tests", "tests\System.Security.Cryptography.Xml.Tests.csproj", "{3C32659A-6DB9-410A-8E24-BE91BFF4C024}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{E7F19085-6570-4811-8D3F-16B576049403} = {E7F19085-6570-4811-8D3F-16B576049403}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Security.Cryptography.Xml", "src\System.Security.Cryptography.Xml.csproj", "{E7F19085-6570-4811-8D3F-16B576049403}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3C32659A-6DB9-410A-8E24-BE91BFF4C024}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3C32659A-6DB9-410A-8E24-BE91BFF4C024}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E7F19085-6570-4811-8D3F-16B576049403}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E7F19085-6570-4811-8D3F-16B576049403}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
7
external/corefx/src/System.Security.Cryptography.Xml/dir.props
vendored
Normal file
7
external/corefx/src/System.Security.Cryptography.Xml/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.0.0</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
10
external/corefx/src/System.Security.Cryptography.Xml/pkg/System.Security.Cryptography.Xml.builds
vendored
Normal file
10
external/corefx/src/System.Security.Cryptography.Xml/pkg/System.Security.Cryptography.Xml.builds
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">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<ItemGroup>
|
||||
<!-- Disabling the builds for Xml until we get it up and running. This excludes it from being built by build.cmd
|
||||
<Project Include="System.Security.Cryptography.Xml.pkgproj"/>
|
||||
-->
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?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.Xml.builds">
|
||||
<SupportedFramework>net462;netcoreapp2.0;$(AllXamarinFrameworks)</SupportedFramework>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\src\System.Security.Cryptography.Xml.builds" />
|
||||
</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>
|
||||
8
external/corefx/src/System.Security.Cryptography.Xml/ref/Configurations.props
vendored
Normal file
8
external/corefx/src/System.Security.Cryptography.Xml/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>
|
||||
539
external/corefx/src/System.Security.Cryptography.Xml/ref/System.Security.Cryptography.Xml.cs
vendored
Normal file
539
external/corefx/src/System.Security.Cryptography.Xml/ref/System.Security.Cryptography.Xml.cs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
10
external/corefx/src/System.Security.Cryptography.Xml/ref/System.Security.Cryptography.Xml.csproj
vendored
Normal file
10
external/corefx/src/System.Security.Cryptography.Xml/ref/System.Security.Cryptography.Xml.csproj
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?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 Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="System.Security.Cryptography.Xml.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
8
external/corefx/src/System.Security.Cryptography.Xml/src/Configurations.props
vendored
Normal file
8
external/corefx/src/System.Security.Cryptography.Xml/src/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>
|
||||
netcoreapp
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
378
external/corefx/src/System.Security.Cryptography.Xml/src/Resources/Strings.resx
vendored
Normal file
378
external/corefx/src/System.Security.Cryptography.Xml/src/Resources/Strings.resx
vendored
Normal file
@@ -0,0 +1,378 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="ArgumentOutOfRange_Index" xml:space="preserve">
|
||||
<value>Index was out of range. Must be non-negative and less than the size of the collection.</value>
|
||||
</data>
|
||||
<data name="Arg_EmptyOrNullString" xml:space="preserve">
|
||||
<value>String cannot be empty or null.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Partial_Chain" xml:space="preserve">
|
||||
<value>A certificate chain could not be built to a trusted root authority.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_BadWrappedKeySize" xml:space="preserve">
|
||||
<value>Bad wrapped key size.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_CipherValueElementRequired" xml:space="preserve">
|
||||
<value>A Cipher Data element should have either a CipherValue or a CipherReference element.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_CreateHashAlgorithmFailed" xml:space="preserve">
|
||||
<value>Could not create hash algorithm object.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_CreateTransformFailed" xml:space="preserve">
|
||||
<value>Could not create the XML transformation identified by the URI {0}.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_CreatedKeyFailed" xml:space="preserve">
|
||||
<value>Failed to create signing key.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_DigestMethodRequired" xml:space="preserve">
|
||||
<value>A DigestMethod must be specified on a Reference prior to generating XML.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_DigestValueRequired" xml:space="preserve">
|
||||
<value>A Reference must contain a DigestValue.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_EnvelopedSignatureRequiresContext" xml:space="preserve">
|
||||
<value>An XmlDocument context is required for enveloped transforms.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_InvalidElement" xml:space="preserve">
|
||||
<value>Malformed element {0}.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_InvalidEncryptionProperty" xml:space="preserve">
|
||||
<value>Malformed encryption property element.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_InvalidKeySize" xml:space="preserve">
|
||||
<value>The key size should be a non negative integer.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_InvalidReference" xml:space="preserve">
|
||||
<value>Malformed reference element.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_InvalidSignatureLength" xml:space="preserve">
|
||||
<value>The length of the signature with a MAC should be less than the hash output length.</value>
|
||||
</data>
|
||||
<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_KeyInfoRequired" xml:space="preserve">
|
||||
<value>A KeyInfo element is required to check the signature.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_KW_BadKeySize" xml:space="preserve">
|
||||
<value>The length of the encrypted data in Key Wrap is either 32, 40 or 48 bytes.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_LoadKeyFailed" xml:space="preserve">
|
||||
<value>Signing key is not loaded.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_MissingAlgorithm" xml:space="preserve">
|
||||
<value>Symmetric algorithm is not specified.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_MissingCipherData" xml:space="preserve">
|
||||
<value>Cipher data is not specified.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_MissingDecryptionKey" xml:space="preserve">
|
||||
<value>Unable to retrieve the decryption key.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_MissingEncryptionKey" xml:space="preserve">
|
||||
<value>Unable to retrieve the encryption key.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_NotSupportedCryptographicTransform" xml:space="preserve">
|
||||
<value>The specified cryptographic transform is not supported.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_ReferenceElementRequired" xml:space="preserve">
|
||||
<value>At least one Reference element is required.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_ReferenceTypeRequired" xml:space="preserve">
|
||||
<value>The Reference type must be set in an EncryptedReference object.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_SelfReferenceRequiresContext" xml:space="preserve">
|
||||
<value>An XmlDocument context is required to resolve the Reference Uri {0}.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_SignatureDescriptionNotCreated" xml:space="preserve">
|
||||
<value>SignatureDescription could not be created for the signature algorithm supplied.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_SignatureMethodKeyMismatch" xml:space="preserve">
|
||||
<value>The key does not fit the SignatureMethod.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_SignatureMethodRequired" xml:space="preserve">
|
||||
<value>A signature method is required.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_SignatureValueRequired" xml:space="preserve">
|
||||
<value>Signature requires a SignatureValue.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_SignedInfoRequired" xml:space="preserve">
|
||||
<value>Signature requires a SignedInfo.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_TransformIncorrectInputType" xml:space="preserve">
|
||||
<value>The input type was invalid for this transform.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_IncorrectObjectType" xml:space="preserve">
|
||||
<value>Type of input object is invalid.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_UnknownTransform" xml:space="preserve">
|
||||
<value>Unknown transform has been encountered.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_UriNotResolved" xml:space="preserve">
|
||||
<value>Unable to resolve Uri {0}.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_UriNotSupported" xml:space="preserve">
|
||||
<value> The specified Uri is not supported.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_UriRequired" xml:space="preserve">
|
||||
<value>A Uri attribute is required for a CipherReference element.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_XrmlMissingContext" xml:space="preserve">
|
||||
<value>Null Context property encountered.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_XrmlMissingIRelDecryptor" xml:space="preserve">
|
||||
<value>IRelDecryptor is required.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_XrmlMissingIssuer" xml:space="preserve">
|
||||
<value>Issuer node is required.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_XrmlMissingLicence" xml:space="preserve">
|
||||
<value>License node is required.</value>
|
||||
</data>
|
||||
<data name="Cryptography_Xml_XrmlUnableToDecryptGrant" xml:space="preserve">
|
||||
<value>Unable to decrypt grant content.</value>
|
||||
</data>
|
||||
<data name="NotSupported_KeyAlgorithm" xml:space="preserve">
|
||||
<value>The certificate key algorithm is not supported.</value>
|
||||
</data>
|
||||
<data name="Log_ActualHashValue" xml:space="preserve">
|
||||
<value>Actual hash value: {0}</value>
|
||||
</data>
|
||||
<data name="Log_BeginCanonicalization" xml:space="preserve">
|
||||
<value>Beginning canonicalization using "{0}" ({1}).</value>
|
||||
</data>
|
||||
<data name="Log_BeginSignatureComputation" xml:space="preserve">
|
||||
<value>Beginning signature computation.</value>
|
||||
</data>
|
||||
<data name="Log_BeginSignatureVerification" xml:space="preserve">
|
||||
<value>Beginning signature verification.</value>
|
||||
</data>
|
||||
<data name="Log_BuildX509Chain" xml:space="preserve">
|
||||
<value>Building and verifying the X509 chain for certificate {0}.</value>
|
||||
</data>
|
||||
<data name="Log_CanonicalizationSettings" xml:space="preserve">
|
||||
<value>Canonicalization transform is using resolver {0} and base URI "{1}".</value>
|
||||
</data>
|
||||
<data name="Log_CanonicalizedOutput" xml:space="preserve">
|
||||
<value>Output of canonicalization transform: {0}</value>
|
||||
</data>
|
||||
<data name="Log_CertificateChain" xml:space="preserve">
|
||||
<value>Certificate chain:</value>
|
||||
</data>
|
||||
<data name="Log_CheckSignatureFormat" xml:space="preserve">
|
||||
<value>Checking signature format using format validator "[{0}] {1}.{2}".</value>
|
||||
</data>
|
||||
<data name="Log_CheckSignedInfo" xml:space="preserve">
|
||||
<value>Checking signature on SignedInfo with id "{0}".</value>
|
||||
</data>
|
||||
<data name="Log_FormatValidationSuccessful" xml:space="preserve">
|
||||
<value>Signature format validation was successful.</value>
|
||||
</data>
|
||||
<data name="Log_FormatValidationNotSuccessful" xml:space="preserve">
|
||||
<value>Signature format validation failed.</value>
|
||||
</data>
|
||||
<data name="Log_KeyUsages" xml:space="preserve">
|
||||
<value>Found key usages "{0}" in extension {1} on certificate {2}.</value>
|
||||
</data>
|
||||
<data name="Log_NoNamespacesPropagated" xml:space="preserve">
|
||||
<value>No namespaces are being propagated.</value>
|
||||
</data>
|
||||
<data name="Log_PropagatingNamespace" xml:space="preserve">
|
||||
<value>Propagating namespace {0}="{1}".</value>
|
||||
</data>
|
||||
<data name="Log_RawSignatureValue" xml:space="preserve">
|
||||
<value>Raw signature: {0}</value>
|
||||
</data>
|
||||
<data name="Log_ReferenceHash" xml:space="preserve">
|
||||
<value>Reference {0} hashed with "{1}" ({2}) has hash value {3}, expected hash value {4}.</value>
|
||||
</data>
|
||||
<data name="Log_RevocationMode" xml:space="preserve">
|
||||
<value>Revocation mode for chain building: {0}.</value>
|
||||
</data>
|
||||
<data name="Log_RevocationFlag" xml:space="preserve">
|
||||
<value>Revocation flag for chain building: {0}.</value>
|
||||
</data>
|
||||
<data name="Log_SigningAsymmetric" xml:space="preserve">
|
||||
<value>Calculating signature with key {0} using signature description {1}, hash algorithm {2}, and asymmetric signature formatter {3}.</value>
|
||||
</data>
|
||||
<data name="Log_SigningHmac" xml:space="preserve">
|
||||
<value>Calculating signature using keyed hash algorithm {0}.</value>
|
||||
</data>
|
||||
<data name="Log_SigningReference" xml:space="preserve">
|
||||
<value>Hashing reference {0}, Uri "{1}", Id "{2}", Type "{3}" with hash algorithm "{4}" ({5}).</value>
|
||||
</data>
|
||||
<data name="Log_TransformedReferenceContents" xml:space="preserve">
|
||||
<value>Transformed reference contents: {0}</value>
|
||||
</data>
|
||||
<data name="Log_UnsafeCanonicalizationMethod" xml:space="preserve">
|
||||
<value>Canonicalization method "{0}" is not on the safe list. Safe canonicalization methods are: {1}.</value>
|
||||
</data>
|
||||
<data name="Log_UrlTimeout" xml:space="preserve">
|
||||
<value>URL retrieval timeout for chain building: {0}.</value>
|
||||
</data>
|
||||
<data name="Log_VerificationFailed" xml:space="preserve">
|
||||
<value>Verification failed checking {0}.</value>
|
||||
</data>
|
||||
<data name="Log_VerificationFailed_References" xml:space="preserve">
|
||||
<value>references</value>
|
||||
</data>
|
||||
<data name="Log_VerificationFailed_SignedInfo" xml:space="preserve">
|
||||
<value>SignedInfo</value>
|
||||
</data>
|
||||
<data name="Log_VerificationFailed_X509Chain" xml:space="preserve">
|
||||
<value>X509 chain verification</value>
|
||||
</data>
|
||||
<data name="Log_VerificationFailed_X509KeyUsage" xml:space="preserve">
|
||||
<value>X509 key usage verification</value>
|
||||
</data>
|
||||
<data name="Log_VerificationFlag" xml:space="preserve">
|
||||
<value>Verification flags for chain building: {0}.</value>
|
||||
</data>
|
||||
<data name="Log_VerificationTime" xml:space="preserve">
|
||||
<value>Verification time for chain building: {0}.</value>
|
||||
</data>
|
||||
<data name="Log_VerificationWithKeySuccessful" xml:space="preserve">
|
||||
<value>Verification with key {0} was successful.</value>
|
||||
</data>
|
||||
<data name="Log_VerificationWithKeyNotSuccessful" xml:space="preserve">
|
||||
<value>Verification with key {0} was not successful.</value>
|
||||
</data>
|
||||
<data name="Log_VerifyReference" xml:space="preserve">
|
||||
<value>Processing reference {0}, Uri "{1}", Id "{2}", Type "{3}".</value>
|
||||
</data>
|
||||
<data name="Log_VerifySignedInfoAsymmetric" xml:space="preserve">
|
||||
<value>Verifying SignedInfo using key {0}, signature description {1}, hash algorithm {2}, and asymmetric signature deformatter {3}.</value>
|
||||
</data>
|
||||
<data name="Log_VerifySignedInfoHmac" xml:space="preserve">
|
||||
<value>Verifying SignedInfo using keyed hash algorithm {0}.</value>
|
||||
</data>
|
||||
<data name="Log_X509ChainError" xml:space="preserve">
|
||||
<value>Error building X509 chain: {0}: {1}.</value>
|
||||
</data>
|
||||
<data name="Log_XmlContext" xml:space="preserve">
|
||||
<value>Using context: {0}</value>
|
||||
</data>
|
||||
<data name="Log_SignedXmlRecursionLimit" xml:space="preserve">
|
||||
<value>Signed xml recursion limit hit while trying to decrypt the key. Reference {0} hashed with "{1}" and ({2}).</value>
|
||||
</data>
|
||||
<data name="Log_UnsafeTransformMethod" xml:space="preserve">
|
||||
<value>Transform method "{0}" is not on the safe list. Safe transform methods are: {1}.</value>
|
||||
</data>
|
||||
</root>
|
||||
105
external/corefx/src/System.Security.Cryptography.Xml/src/System.Security.Cryptography.Xml.csproj
vendored
Normal file
105
external/corefx/src/System.Security.Cryptography.Xml/src/System.Security.Cryptography.Xml.csproj
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
<?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>
|
||||
<AssemblyName>System.Security.Cryptography.Xml</AssemblyName>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<!-- Help VS understand available configurations -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
|
||||
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true'">
|
||||
<Compile Include="System\Security\Cryptography\Xml\AncestralNamespaceContextManager.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\AttributeSortOrder.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\C14NAncestralNamespaceContextManager.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\CanonicalizationDispatcher.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\CanonicalXml.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\CanonicalXmlAttribute.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\CanonicalXmlCDataSection.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\CanonicalXmlComment.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\CanonicalXmlDocument.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\CanonicalXmlElement.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\CanonicalXmlEntityReference.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\CanonicalXmlNodeList.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\CanonicalXmlProcessingInstruction.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\CanonicalXmlSignificantWhitespace.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\CanonicalXmlText.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\CanonicalXmlWhitespace.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\CertUsageType.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\CipherData.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\CipherReference.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\CryptoSignedXmlRecursionException.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\DataObject.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\DataReference.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\DocPosition.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\DSAKeyValue.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\EncryptedData.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\EncryptedKey.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\EncryptedReference.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\EncryptedType.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\EncryptedXml.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\EncryptionMethod.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\EncryptionProperty.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\EncryptionPropertyCollection.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\ExcAncestralNamespaceContextManager.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\ExcCanonicalXml.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\ICanonicalizableNode.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\IRelDecryptor.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\KeyInfo.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\KeyInfoClause.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\KeyInfoEncryptedKey.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\KeyInfoName.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\KeyInfoNode.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\KeyInfoRetrievalMethod.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\KeyInfoX509Data.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\KeyReference.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\MyXmlDocument.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\NamespaceFrame.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\NamespaceSortOrder.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\Reference.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\ReferenceList.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\ReferenceTargetType.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\RSAKeyValue.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\Signature.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\SignedInfo.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\SignedXml.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\SignedXmlDebugLog.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\SymmetricKeyWrap.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\Transform.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\TransformChain.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\TransformInputType.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\Utils.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\X509IssuerSerial.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\XmlDecryptionTransform.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\XmlDsigBase64Transform.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\XmlDsigC14NTransform.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\XmlDsigC14NWithCommentsTransform.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\XmlDsigEnvelopedSignatureTransform.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\XmlDsigExcC14NTransform.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\XmlDsigExcC14NWithCommentsTransform.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\XmlDsigXPathTransform.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\XmlDsigXsltTransform.cs" />
|
||||
<Compile Include="System\Security\Cryptography\Xml\XmlLicenseTransform.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Collections" />
|
||||
<Reference Include="System.Collections.NonGeneric" />
|
||||
<Reference Include="System.Diagnostics.Debug" />
|
||||
<Reference Include="System.Diagnostics.Tools" />
|
||||
<Reference Include="System.Diagnostics.TraceSource" />
|
||||
<Reference Include="System.Net.Requests" />
|
||||
<Reference Include="System.Resources.ResourceManager" />
|
||||
<Reference Include="System.Runtime" />
|
||||
<Reference Include="System.Runtime.Extensions" />
|
||||
<Reference Include="System.Runtime.Numerics" />
|
||||
<Reference Include="System.Security.Cryptography.Algorithms" />
|
||||
<Reference Include="System.Security.Cryptography.Csp" />
|
||||
<Reference Include="System.Security.Cryptography.Encoding" />
|
||||
<Reference Include="System.Security.Cryptography.Primitives" />
|
||||
<Reference Include="System.Security.Cryptography.X509Certificates" />
|
||||
<Reference Include="System.Text.Encoding.Extensions" />
|
||||
<Reference Include="System.Xml.ReaderWriter" />
|
||||
<Reference Include="System.Xml.XPath" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,99 @@
|
||||
// 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.Xml;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Security.Cryptography.Xml
|
||||
{
|
||||
internal abstract class AncestralNamespaceContextManager
|
||||
{
|
||||
internal ArrayList _ancestorStack = new ArrayList();
|
||||
|
||||
internal NamespaceFrame GetScopeAt(int i)
|
||||
{
|
||||
return (NamespaceFrame)_ancestorStack[i];
|
||||
}
|
||||
|
||||
internal NamespaceFrame GetCurrentScope()
|
||||
{
|
||||
return GetScopeAt(_ancestorStack.Count - 1);
|
||||
}
|
||||
|
||||
protected XmlAttribute GetNearestRenderedNamespaceWithMatchingPrefix(string nsPrefix, out int depth)
|
||||
{
|
||||
XmlAttribute attr = null;
|
||||
depth = -1;
|
||||
for (int i = _ancestorStack.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if ((attr = GetScopeAt(i).GetRendered(nsPrefix)) != null)
|
||||
{
|
||||
depth = i;
|
||||
return attr;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected XmlAttribute GetNearestUnrenderedNamespaceWithMatchingPrefix(string nsPrefix, out int depth)
|
||||
{
|
||||
XmlAttribute attr = null;
|
||||
depth = -1;
|
||||
for (int i = _ancestorStack.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if ((attr = GetScopeAt(i).GetUnrendered(nsPrefix)) != null)
|
||||
{
|
||||
depth = i;
|
||||
return attr;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
internal void EnterElementContext()
|
||||
{
|
||||
_ancestorStack.Add(new NamespaceFrame());
|
||||
}
|
||||
|
||||
internal void ExitElementContext()
|
||||
{
|
||||
_ancestorStack.RemoveAt(_ancestorStack.Count - 1);
|
||||
}
|
||||
|
||||
internal abstract void TrackNamespaceNode(XmlAttribute attr, SortedList nsListToRender, Hashtable nsLocallyDeclared);
|
||||
internal abstract void TrackXmlNamespaceNode(XmlAttribute attr, SortedList nsListToRender, SortedList attrListToRender, Hashtable nsLocallyDeclared);
|
||||
internal abstract void GetNamespacesToRender(XmlElement element, SortedList attrListToRender, SortedList nsListToRender, Hashtable nsLocallyDeclared);
|
||||
|
||||
internal void LoadUnrenderedNamespaces(Hashtable nsLocallyDeclared)
|
||||
{
|
||||
object[] attrs = new object[nsLocallyDeclared.Count];
|
||||
nsLocallyDeclared.Values.CopyTo(attrs, 0);
|
||||
foreach (object attr in attrs)
|
||||
{
|
||||
AddUnrendered((XmlAttribute)attr);
|
||||
}
|
||||
}
|
||||
|
||||
internal void LoadRenderedNamespaces(SortedList nsRenderedList)
|
||||
{
|
||||
foreach (object attr in nsRenderedList.GetKeyList())
|
||||
{
|
||||
AddRendered((XmlAttribute)attr);
|
||||
}
|
||||
}
|
||||
|
||||
internal void AddRendered(XmlAttribute attr)
|
||||
{
|
||||
GetCurrentScope().AddRendered(attr);
|
||||
}
|
||||
|
||||
internal void AddUnrendered(XmlAttribute attr)
|
||||
{
|
||||
GetCurrentScope().AddUnrendered(attr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// 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.Xml;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Security.Cryptography.Xml
|
||||
{
|
||||
// This class does lexicographic sorting by NamespaceURI first and then by LocalName.
|
||||
internal class AttributeSortOrder : IComparer
|
||||
{
|
||||
internal AttributeSortOrder() { }
|
||||
|
||||
public int Compare(object a, object b)
|
||||
{
|
||||
XmlNode nodeA = a as XmlNode;
|
||||
XmlNode nodeB = b as XmlNode;
|
||||
if ((a == null) || (b == null))
|
||||
throw new ArgumentException();
|
||||
int namespaceCompare = string.CompareOrdinal(nodeA.NamespaceURI, nodeB.NamespaceURI);
|
||||
if (namespaceCompare != 0) return namespaceCompare;
|
||||
return string.CompareOrdinal(nodeA.LocalName, nodeB.LocalName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
// 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.Xml;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Security.Cryptography.Xml
|
||||
{
|
||||
// the stack of currently active NamespaceFrame contexts. this
|
||||
// object also maintains the inclusive prefix list in a tokenized form.
|
||||
internal class C14NAncestralNamespaceContextManager : AncestralNamespaceContextManager
|
||||
{
|
||||
internal C14NAncestralNamespaceContextManager() { }
|
||||
|
||||
private void GetNamespaceToRender(string nsPrefix, SortedList attrListToRender, SortedList nsListToRender, Hashtable nsLocallyDeclared)
|
||||
{
|
||||
foreach (object a in nsListToRender.GetKeyList())
|
||||
{
|
||||
if (Utils.HasNamespacePrefix((XmlAttribute)a, nsPrefix))
|
||||
return;
|
||||
}
|
||||
foreach (object a in attrListToRender.GetKeyList())
|
||||
{
|
||||
if (((XmlAttribute)a).LocalName.Equals(nsPrefix))
|
||||
return;
|
||||
}
|
||||
|
||||
int rDepth;
|
||||
XmlAttribute local = (XmlAttribute)nsLocallyDeclared[nsPrefix];
|
||||
XmlAttribute rAncestral = GetNearestRenderedNamespaceWithMatchingPrefix(nsPrefix, out rDepth);
|
||||
if (local != null)
|
||||
{
|
||||
if (Utils.IsNonRedundantNamespaceDecl(local, rAncestral))
|
||||
{
|
||||
nsLocallyDeclared.Remove(nsPrefix);
|
||||
if (Utils.IsXmlNamespaceNode(local))
|
||||
attrListToRender.Add(local, null);
|
||||
else
|
||||
nsListToRender.Add(local, null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int uDepth;
|
||||
XmlAttribute uAncestral = GetNearestUnrenderedNamespaceWithMatchingPrefix(nsPrefix, out uDepth);
|
||||
if (uAncestral != null && uDepth > rDepth && Utils.IsNonRedundantNamespaceDecl(uAncestral, rAncestral))
|
||||
{
|
||||
if (Utils.IsXmlNamespaceNode(uAncestral))
|
||||
attrListToRender.Add(uAncestral, null);
|
||||
else
|
||||
nsListToRender.Add(uAncestral, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal override void GetNamespacesToRender(XmlElement element, SortedList attrListToRender, SortedList nsListToRender, Hashtable nsLocallyDeclared)
|
||||
{
|
||||
XmlAttribute attrib = null;
|
||||
object[] attrs = new object[nsLocallyDeclared.Count];
|
||||
nsLocallyDeclared.Values.CopyTo(attrs, 0);
|
||||
foreach (object a in attrs)
|
||||
{
|
||||
attrib = (XmlAttribute)a;
|
||||
int rDepth;
|
||||
XmlAttribute rAncestral = GetNearestRenderedNamespaceWithMatchingPrefix(Utils.GetNamespacePrefix(attrib), out rDepth);
|
||||
if (Utils.IsNonRedundantNamespaceDecl(attrib, rAncestral))
|
||||
{
|
||||
nsLocallyDeclared.Remove(Utils.GetNamespacePrefix(attrib));
|
||||
if (Utils.IsXmlNamespaceNode(attrib))
|
||||
attrListToRender.Add(attrib, null);
|
||||
else
|
||||
nsListToRender.Add(attrib, null);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = _ancestorStack.Count - 1; i >= 0; i--)
|
||||
{
|
||||
foreach (object a in GetScopeAt(i).GetUnrendered().Values)
|
||||
{
|
||||
attrib = (XmlAttribute)a;
|
||||
if (attrib != null)
|
||||
GetNamespaceToRender(Utils.GetNamespacePrefix(attrib), attrListToRender, nsListToRender, nsLocallyDeclared);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal override void TrackNamespaceNode(XmlAttribute attr, SortedList nsListToRender, Hashtable nsLocallyDeclared)
|
||||
{
|
||||
nsLocallyDeclared.Add(Utils.GetNamespacePrefix(attr), attr);
|
||||
}
|
||||
|
||||
internal override void TrackXmlNamespaceNode(XmlAttribute attr, SortedList nsListToRender, SortedList attrListToRender, Hashtable nsLocallyDeclared)
|
||||
{
|
||||
nsLocallyDeclared.Add(Utils.GetNamespacePrefix(attr), attr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
// 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.Xml;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Security.Cryptography;
|
||||
using System;
|
||||
|
||||
namespace System.Security.Cryptography.Xml
|
||||
{
|
||||
internal class CanonicalXml
|
||||
{
|
||||
private CanonicalXmlDocument _c14nDoc;
|
||||
private C14NAncestralNamespaceContextManager _ancMgr;
|
||||
|
||||
// private static string defaultXPathWithoutComments = "(//. | //@* | //namespace::*)[not(self::comment())]";
|
||||
// private static string defaultXPathWithoutComments = "(//. | //@* | //namespace::*)";
|
||||
// private static string defaultXPathWithComments = "(//. | //@* | //namespace::*)";
|
||||
// private static string defaultXPathWithComments = "(//. | //@* | //namespace::*)";
|
||||
|
||||
internal CanonicalXml(Stream inputStream, bool includeComments, XmlResolver resolver, string strBaseUri)
|
||||
{
|
||||
if (inputStream == null)
|
||||
throw new ArgumentNullException(nameof(inputStream));
|
||||
|
||||
_c14nDoc = new CanonicalXmlDocument(true, includeComments);
|
||||
_c14nDoc.XmlResolver = resolver;
|
||||
_c14nDoc.Load(Utils.PreProcessStreamInput(inputStream, resolver, strBaseUri));
|
||||
_ancMgr = new C14NAncestralNamespaceContextManager();
|
||||
}
|
||||
|
||||
internal CanonicalXml(XmlDocument document, XmlResolver resolver) : this(document, resolver, false) { }
|
||||
internal CanonicalXml(XmlDocument document, XmlResolver resolver, bool includeComments)
|
||||
{
|
||||
if (document == null)
|
||||
throw new ArgumentNullException(nameof(document));
|
||||
|
||||
_c14nDoc = new CanonicalXmlDocument(true, includeComments);
|
||||
_c14nDoc.XmlResolver = resolver;
|
||||
_c14nDoc.Load(new XmlNodeReader(document));
|
||||
_ancMgr = new C14NAncestralNamespaceContextManager();
|
||||
}
|
||||
|
||||
internal CanonicalXml(XmlNodeList nodeList, XmlResolver resolver, bool includeComments)
|
||||
{
|
||||
if (nodeList == null)
|
||||
throw new ArgumentNullException(nameof(nodeList));
|
||||
|
||||
XmlDocument doc = Utils.GetOwnerDocument(nodeList);
|
||||
if (doc == null)
|
||||
throw new ArgumentException("nodeList");
|
||||
|
||||
_c14nDoc = new CanonicalXmlDocument(false, includeComments);
|
||||
_c14nDoc.XmlResolver = resolver;
|
||||
_c14nDoc.Load(new XmlNodeReader(doc));
|
||||
_ancMgr = new C14NAncestralNamespaceContextManager();
|
||||
|
||||
MarkInclusionStateForNodes(nodeList, doc, _c14nDoc);
|
||||
}
|
||||
|
||||
private static void MarkNodeAsIncluded(XmlNode node)
|
||||
{
|
||||
if (node is ICanonicalizableNode)
|
||||
((ICanonicalizableNode)node).IsInNodeSet = true;
|
||||
}
|
||||
|
||||
private static void MarkInclusionStateForNodes(XmlNodeList nodeList, XmlDocument inputRoot, XmlDocument root)
|
||||
{
|
||||
CanonicalXmlNodeList elementList = new CanonicalXmlNodeList();
|
||||
CanonicalXmlNodeList elementListCanonical = new CanonicalXmlNodeList();
|
||||
elementList.Add(inputRoot);
|
||||
elementListCanonical.Add(root);
|
||||
int index = 0;
|
||||
|
||||
do
|
||||
{
|
||||
XmlNode currentNode = (XmlNode)elementList[index];
|
||||
XmlNode currentNodeCanonical = (XmlNode)elementListCanonical[index];
|
||||
XmlNodeList childNodes = currentNode.ChildNodes;
|
||||
XmlNodeList childNodesCanonical = currentNodeCanonical.ChildNodes;
|
||||
for (int i = 0; i < childNodes.Count; i++)
|
||||
{
|
||||
elementList.Add(childNodes[i]);
|
||||
elementListCanonical.Add(childNodesCanonical[i]);
|
||||
|
||||
if (Utils.NodeInList(childNodes[i], nodeList))
|
||||
{
|
||||
MarkNodeAsIncluded(childNodesCanonical[i]);
|
||||
}
|
||||
|
||||
XmlAttributeCollection attribNodes = childNodes[i].Attributes;
|
||||
if (attribNodes != null)
|
||||
{
|
||||
for (int j = 0; j < attribNodes.Count; j++)
|
||||
{
|
||||
if (Utils.NodeInList(attribNodes[j], nodeList))
|
||||
{
|
||||
MarkNodeAsIncluded(childNodesCanonical[i].Attributes.Item(j));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
index++;
|
||||
} while (index < elementList.Count);
|
||||
}
|
||||
|
||||
internal byte[] GetBytes()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
_c14nDoc.Write(sb, DocPosition.BeforeRootElement, _ancMgr);
|
||||
UTF8Encoding utf8 = new UTF8Encoding(false);
|
||||
return utf8.GetBytes(sb.ToString());
|
||||
}
|
||||
|
||||
internal byte[] GetDigestedBytes(HashAlgorithm hash)
|
||||
{
|
||||
_c14nDoc.WriteHash(hash, DocPosition.BeforeRootElement, _ancMgr);
|
||||
hash.TransformFinalBlock(new byte[0], 0, 0);
|
||||
byte[] res = (byte[])hash.Hash.Clone();
|
||||
// reinitialize the hash so it is still usable after the call
|
||||
hash.Initialize();
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
// 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.Xml;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace System.Security.Cryptography.Xml
|
||||
{
|
||||
// the class that provides node subset state and canonicalization function to XmlAttribute
|
||||
internal class CanonicalXmlAttribute : XmlAttribute, ICanonicalizableNode
|
||||
{
|
||||
private bool _isInNodeSet;
|
||||
|
||||
public CanonicalXmlAttribute(string prefix, string localName, string namespaceURI, XmlDocument doc, bool defaultNodeSetInclusionState)
|
||||
: base(prefix, localName, namespaceURI, doc)
|
||||
{
|
||||
IsInNodeSet = defaultNodeSetInclusionState;
|
||||
}
|
||||
|
||||
public bool IsInNodeSet
|
||||
{
|
||||
get { return _isInNodeSet; }
|
||||
set { _isInNodeSet = value; }
|
||||
}
|
||||
|
||||
public void Write(StringBuilder strBuilder, DocPosition docPos, AncestralNamespaceContextManager anc)
|
||||
{
|
||||
strBuilder.Append(" " + Name + "=\"");
|
||||
strBuilder.Append(Utils.EscapeAttributeValue(Value));
|
||||
strBuilder.Append("\"");
|
||||
}
|
||||
|
||||
public void WriteHash(HashAlgorithm hash, DocPosition docPos, AncestralNamespaceContextManager anc)
|
||||
{
|
||||
UTF8Encoding utf8 = new UTF8Encoding(false);
|
||||
byte[] rgbData = utf8.GetBytes(" " + Name + "=\"");
|
||||
hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
|
||||
rgbData = utf8.GetBytes(Utils.EscapeAttributeValue(Value));
|
||||
hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
|
||||
rgbData = utf8.GetBytes("\"");
|
||||
hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// 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.Xml;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace System.Security.Cryptography.Xml
|
||||
{
|
||||
// the class that provides node subset state and canonicalization function to XmlCDataSection
|
||||
internal class CanonicalXmlCDataSection : XmlCDataSection, ICanonicalizableNode
|
||||
{
|
||||
private bool _isInNodeSet;
|
||||
public CanonicalXmlCDataSection(string data, XmlDocument doc, bool defaultNodeSetInclusionState) : base(data, doc)
|
||||
{
|
||||
_isInNodeSet = defaultNodeSetInclusionState;
|
||||
}
|
||||
|
||||
public bool IsInNodeSet
|
||||
{
|
||||
get { return _isInNodeSet; }
|
||||
set { _isInNodeSet = value; }
|
||||
}
|
||||
|
||||
public void Write(StringBuilder strBuilder, DocPosition docPos, AncestralNamespaceContextManager anc)
|
||||
{
|
||||
if (IsInNodeSet)
|
||||
strBuilder.Append(Utils.EscapeCData(Data));
|
||||
}
|
||||
|
||||
public void WriteHash(HashAlgorithm hash, DocPosition docPos, AncestralNamespaceContextManager anc)
|
||||
{
|
||||
if (IsInNodeSet)
|
||||
{
|
||||
UTF8Encoding utf8 = new UTF8Encoding(false);
|
||||
byte[] rgbData = utf8.GetBytes(Utils.EscapeCData(Data));
|
||||
hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
// 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.Xml;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace System.Security.Cryptography.Xml
|
||||
{
|
||||
// the class that provides node subset state and canonicalization function to XmlComment
|
||||
internal class CanonicalXmlComment : XmlComment, ICanonicalizableNode
|
||||
{
|
||||
private bool _isInNodeSet;
|
||||
private bool _includeComments;
|
||||
|
||||
public CanonicalXmlComment(string comment, XmlDocument doc, bool defaultNodeSetInclusionState, bool includeComments)
|
||||
: base(comment, doc)
|
||||
{
|
||||
_isInNodeSet = defaultNodeSetInclusionState;
|
||||
_includeComments = includeComments;
|
||||
}
|
||||
|
||||
public bool IsInNodeSet
|
||||
{
|
||||
get { return _isInNodeSet; }
|
||||
set { _isInNodeSet = value; }
|
||||
}
|
||||
|
||||
public bool IncludeComments
|
||||
{
|
||||
get { return _includeComments; }
|
||||
}
|
||||
|
||||
public void Write(StringBuilder strBuilder, DocPosition docPos, AncestralNamespaceContextManager anc)
|
||||
{
|
||||
if (!IsInNodeSet || !IncludeComments)
|
||||
return;
|
||||
|
||||
if (docPos == DocPosition.AfterRootElement)
|
||||
strBuilder.Append((char)10);
|
||||
strBuilder.Append("<!--");
|
||||
strBuilder.Append(Value);
|
||||
strBuilder.Append("-->");
|
||||
if (docPos == DocPosition.BeforeRootElement)
|
||||
strBuilder.Append((char)10);
|
||||
}
|
||||
|
||||
public void WriteHash(HashAlgorithm hash, DocPosition docPos, AncestralNamespaceContextManager anc)
|
||||
{
|
||||
if (!IsInNodeSet || !IncludeComments)
|
||||
return;
|
||||
|
||||
UTF8Encoding utf8 = new UTF8Encoding(false);
|
||||
byte[] rgbData = utf8.GetBytes("(char) 10");
|
||||
if (docPos == DocPosition.AfterRootElement)
|
||||
hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
|
||||
rgbData = utf8.GetBytes("<!--");
|
||||
hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
|
||||
rgbData = utf8.GetBytes(Value);
|
||||
hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
|
||||
rgbData = utf8.GetBytes("-->");
|
||||
hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
|
||||
if (docPos == DocPosition.BeforeRootElement)
|
||||
{
|
||||
rgbData = utf8.GetBytes("(char) 10");
|
||||
hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
// 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.Xml;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace System.Security.Cryptography.Xml
|
||||
{
|
||||
// all input types eventually lead to the creation of an XmlDocument document
|
||||
// of this type. it maintains the node subset state and performs output rendering during canonicalization
|
||||
internal class CanonicalXmlDocument : XmlDocument, ICanonicalizableNode
|
||||
{
|
||||
private bool _defaultNodeSetInclusionState;
|
||||
private bool _includeComments;
|
||||
private bool _isInNodeSet;
|
||||
|
||||
public CanonicalXmlDocument(bool defaultNodeSetInclusionState, bool includeComments) : base()
|
||||
{
|
||||
PreserveWhitespace = true;
|
||||
_includeComments = includeComments;
|
||||
_isInNodeSet = _defaultNodeSetInclusionState = defaultNodeSetInclusionState;
|
||||
}
|
||||
|
||||
public bool IsInNodeSet
|
||||
{
|
||||
get { return _isInNodeSet; }
|
||||
set { _isInNodeSet = value; }
|
||||
}
|
||||
|
||||
public void Write(StringBuilder strBuilder, DocPosition docPos, AncestralNamespaceContextManager anc)
|
||||
{
|
||||
docPos = DocPosition.BeforeRootElement;
|
||||
foreach (XmlNode childNode in ChildNodes)
|
||||
{
|
||||
if (childNode.NodeType == XmlNodeType.Element)
|
||||
{
|
||||
CanonicalizationDispatcher.Write(childNode, strBuilder, DocPosition.InRootElement, anc);
|
||||
docPos = DocPosition.AfterRootElement;
|
||||
}
|
||||
else
|
||||
{
|
||||
CanonicalizationDispatcher.Write(childNode, strBuilder, docPos, anc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteHash(HashAlgorithm hash, DocPosition docPos, AncestralNamespaceContextManager anc)
|
||||
{
|
||||
docPos = DocPosition.BeforeRootElement;
|
||||
foreach (XmlNode childNode in ChildNodes)
|
||||
{
|
||||
if (childNode.NodeType == XmlNodeType.Element)
|
||||
{
|
||||
CanonicalizationDispatcher.WriteHash(childNode, hash, DocPosition.InRootElement, anc);
|
||||
docPos = DocPosition.AfterRootElement;
|
||||
}
|
||||
else
|
||||
{
|
||||
CanonicalizationDispatcher.WriteHash(childNode, hash, docPos, anc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override XmlElement CreateElement(string prefix, string localName, string namespaceURI)
|
||||
{
|
||||
return new CanonicalXmlElement(prefix, localName, namespaceURI, this, _defaultNodeSetInclusionState);
|
||||
}
|
||||
|
||||
public override XmlAttribute CreateAttribute(string prefix, string localName, string namespaceURI)
|
||||
{
|
||||
return new CanonicalXmlAttribute(prefix, localName, namespaceURI, this, _defaultNodeSetInclusionState);
|
||||
}
|
||||
|
||||
protected override XmlAttribute CreateDefaultAttribute(string prefix, string localName, string namespaceURI)
|
||||
{
|
||||
return new CanonicalXmlAttribute(prefix, localName, namespaceURI, this, _defaultNodeSetInclusionState);
|
||||
}
|
||||
|
||||
public override XmlText CreateTextNode(string text)
|
||||
{
|
||||
return new CanonicalXmlText(text, this, _defaultNodeSetInclusionState);
|
||||
}
|
||||
|
||||
public override XmlWhitespace CreateWhitespace(string prefix)
|
||||
{
|
||||
return new CanonicalXmlWhitespace(prefix, this, _defaultNodeSetInclusionState);
|
||||
}
|
||||
|
||||
public override XmlSignificantWhitespace CreateSignificantWhitespace(string text)
|
||||
{
|
||||
return new CanonicalXmlSignificantWhitespace(text, this, _defaultNodeSetInclusionState);
|
||||
}
|
||||
|
||||
public override XmlProcessingInstruction CreateProcessingInstruction(string target, string data)
|
||||
{
|
||||
return new CanonicalXmlProcessingInstruction(target, data, this, _defaultNodeSetInclusionState);
|
||||
}
|
||||
|
||||
public override XmlComment CreateComment(string data)
|
||||
{
|
||||
return new CanonicalXmlComment(data, this, _defaultNodeSetInclusionState, _includeComments);
|
||||
}
|
||||
|
||||
public override XmlEntityReference CreateEntityReference(string name)
|
||||
{
|
||||
return new CanonicalXmlEntityReference(name, this, _defaultNodeSetInclusionState);
|
||||
}
|
||||
|
||||
public override XmlCDataSection CreateCDataSection(string data)
|
||||
{
|
||||
return new CanonicalXmlCDataSection(data, this, _defaultNodeSetInclusionState);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
// 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.Xml;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace System.Security.Cryptography.Xml
|
||||
{
|
||||
// the class that provides node subset state and canonicalization function to XmlElement
|
||||
internal class CanonicalXmlElement : XmlElement, ICanonicalizableNode
|
||||
{
|
||||
private bool _isInNodeSet;
|
||||
|
||||
public CanonicalXmlElement(string prefix, string localName, string namespaceURI, XmlDocument doc, bool defaultNodeSetInclusionState)
|
||||
: base(prefix, localName, namespaceURI, doc)
|
||||
{
|
||||
_isInNodeSet = defaultNodeSetInclusionState;
|
||||
}
|
||||
|
||||
public bool IsInNodeSet
|
||||
{
|
||||
get { return _isInNodeSet; }
|
||||
set { _isInNodeSet = value; }
|
||||
}
|
||||
|
||||
public void Write(StringBuilder strBuilder, DocPosition docPos, AncestralNamespaceContextManager anc)
|
||||
{
|
||||
Hashtable nsLocallyDeclared = new Hashtable();
|
||||
SortedList nsListToRender = new SortedList(new NamespaceSortOrder());
|
||||
SortedList attrListToRender = new SortedList(new AttributeSortOrder());
|
||||
|
||||
XmlAttributeCollection attrList = Attributes;
|
||||
if (attrList != null)
|
||||
{
|
||||
foreach (XmlAttribute attr in attrList)
|
||||
{
|
||||
if (((CanonicalXmlAttribute)attr).IsInNodeSet || Utils.IsNamespaceNode(attr) || Utils.IsXmlNamespaceNode(attr))
|
||||
{
|
||||
if (Utils.IsNamespaceNode(attr))
|
||||
{
|
||||
anc.TrackNamespaceNode(attr, nsListToRender, nsLocallyDeclared);
|
||||
}
|
||||
else if (Utils.IsXmlNamespaceNode(attr))
|
||||
{
|
||||
anc.TrackXmlNamespaceNode(attr, nsListToRender, attrListToRender, nsLocallyDeclared);
|
||||
}
|
||||
else if (IsInNodeSet)
|
||||
{
|
||||
attrListToRender.Add(attr, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!Utils.IsCommittedNamespace(this, Prefix, NamespaceURI))
|
||||
{
|
||||
string name = ((Prefix.Length > 0) ? "xmlns" + ":" + Prefix : "xmlns");
|
||||
XmlAttribute nsattrib = (XmlAttribute)OwnerDocument.CreateAttribute(name);
|
||||
nsattrib.Value = NamespaceURI;
|
||||
anc.TrackNamespaceNode(nsattrib, nsListToRender, nsLocallyDeclared);
|
||||
}
|
||||
|
||||
if (IsInNodeSet)
|
||||
{
|
||||
anc.GetNamespacesToRender(this, attrListToRender, nsListToRender, nsLocallyDeclared);
|
||||
|
||||
strBuilder.Append("<" + Name);
|
||||
foreach (object attr in nsListToRender.GetKeyList())
|
||||
{
|
||||
(attr as CanonicalXmlAttribute).Write(strBuilder, docPos, anc);
|
||||
}
|
||||
foreach (object attr in attrListToRender.GetKeyList())
|
||||
{
|
||||
(attr as CanonicalXmlAttribute).Write(strBuilder, docPos, anc);
|
||||
}
|
||||
strBuilder.Append(">");
|
||||
}
|
||||
|
||||
anc.EnterElementContext();
|
||||
anc.LoadUnrenderedNamespaces(nsLocallyDeclared);
|
||||
anc.LoadRenderedNamespaces(nsListToRender);
|
||||
|
||||
XmlNodeList childNodes = ChildNodes;
|
||||
foreach (XmlNode childNode in childNodes)
|
||||
{
|
||||
CanonicalizationDispatcher.Write(childNode, strBuilder, docPos, anc);
|
||||
}
|
||||
|
||||
anc.ExitElementContext();
|
||||
|
||||
if (IsInNodeSet)
|
||||
{
|
||||
strBuilder.Append("</" + Name + ">");
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteHash(HashAlgorithm hash, DocPosition docPos, AncestralNamespaceContextManager anc)
|
||||
{
|
||||
Hashtable nsLocallyDeclared = new Hashtable();
|
||||
SortedList nsListToRender = new SortedList(new NamespaceSortOrder());
|
||||
SortedList attrListToRender = new SortedList(new AttributeSortOrder());
|
||||
UTF8Encoding utf8 = new UTF8Encoding(false);
|
||||
byte[] rgbData;
|
||||
|
||||
XmlAttributeCollection attrList = Attributes;
|
||||
if (attrList != null)
|
||||
{
|
||||
foreach (XmlAttribute attr in attrList)
|
||||
{
|
||||
if (((CanonicalXmlAttribute)attr).IsInNodeSet || Utils.IsNamespaceNode(attr) || Utils.IsXmlNamespaceNode(attr))
|
||||
{
|
||||
if (Utils.IsNamespaceNode(attr))
|
||||
{
|
||||
anc.TrackNamespaceNode(attr, nsListToRender, nsLocallyDeclared);
|
||||
}
|
||||
else if (Utils.IsXmlNamespaceNode(attr))
|
||||
{
|
||||
anc.TrackXmlNamespaceNode(attr, nsListToRender, attrListToRender, nsLocallyDeclared);
|
||||
}
|
||||
else if (IsInNodeSet)
|
||||
{
|
||||
attrListToRender.Add(attr, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!Utils.IsCommittedNamespace(this, Prefix, NamespaceURI))
|
||||
{
|
||||
string name = ((Prefix.Length > 0) ? "xmlns" + ":" + Prefix : "xmlns");
|
||||
XmlAttribute nsattrib = (XmlAttribute)OwnerDocument.CreateAttribute(name);
|
||||
nsattrib.Value = NamespaceURI;
|
||||
anc.TrackNamespaceNode(nsattrib, nsListToRender, nsLocallyDeclared);
|
||||
}
|
||||
|
||||
if (IsInNodeSet)
|
||||
{
|
||||
anc.GetNamespacesToRender(this, attrListToRender, nsListToRender, nsLocallyDeclared);
|
||||
rgbData = utf8.GetBytes("<" + Name);
|
||||
hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
|
||||
foreach (object attr in nsListToRender.GetKeyList())
|
||||
{
|
||||
(attr as CanonicalXmlAttribute).WriteHash(hash, docPos, anc);
|
||||
}
|
||||
foreach (object attr in attrListToRender.GetKeyList())
|
||||
{
|
||||
(attr as CanonicalXmlAttribute).WriteHash(hash, docPos, anc);
|
||||
}
|
||||
rgbData = utf8.GetBytes(">");
|
||||
hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
|
||||
}
|
||||
|
||||
anc.EnterElementContext();
|
||||
anc.LoadUnrenderedNamespaces(nsLocallyDeclared);
|
||||
anc.LoadRenderedNamespaces(nsListToRender);
|
||||
|
||||
XmlNodeList childNodes = ChildNodes;
|
||||
foreach (XmlNode childNode in childNodes)
|
||||
{
|
||||
CanonicalizationDispatcher.WriteHash(childNode, hash, docPos, anc);
|
||||
}
|
||||
|
||||
anc.ExitElementContext();
|
||||
|
||||
if (IsInNodeSet)
|
||||
{
|
||||
rgbData = utf8.GetBytes("</" + Name + ">");
|
||||
hash.TransformBlock(rgbData, 0, rgbData.Length, rgbData, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
// 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.Xml;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace System.Security.Cryptography.Xml
|
||||
{
|
||||
// the class that provides node subset state and canonicalization function to XmlEntityReference
|
||||
internal class CanonicalXmlEntityReference : XmlEntityReference, ICanonicalizableNode
|
||||
{
|
||||
private bool _isInNodeSet;
|
||||
|
||||
public CanonicalXmlEntityReference(string name, XmlDocument doc, bool defaultNodeSetInclusionState)
|
||||
: base(name, doc)
|
||||
{
|
||||
_isInNodeSet = defaultNodeSetInclusionState;
|
||||
}
|
||||
|
||||
public bool IsInNodeSet
|
||||
{
|
||||
get { return _isInNodeSet; }
|
||||
set { _isInNodeSet = value; }
|
||||
}
|
||||
|
||||
public void Write(StringBuilder strBuilder, DocPosition docPos, AncestralNamespaceContextManager anc)
|
||||
{
|
||||
if (IsInNodeSet)
|
||||
CanonicalizationDispatcher.WriteGenericNode(this, strBuilder, docPos, anc);
|
||||
}
|
||||
|
||||
public void WriteHash(HashAlgorithm hash, DocPosition docPos, AncestralNamespaceContextManager anc)
|
||||
{
|
||||
if (IsInNodeSet)
|
||||
CanonicalizationDispatcher.WriteHashGenericNode(this, hash, docPos, anc);
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user