You've already forked linux-packaging-mono
Imported Upstream version 5.10.0.47
Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
parent
88ff76fe28
commit
e46a49ecf1
@@ -116,6 +116,8 @@ namespace System.Security.Cryptography.Xml
|
||||
public const string XmlEncTripleDESUrl = "http://www.w3.org/2001/04/xmlenc#tripledes-cbc";
|
||||
public EncryptedXml() { }
|
||||
public EncryptedXml(System.Xml.XmlDocument document) { }
|
||||
public EncryptedXml(System.Xml.XmlDocument document, System.Security.Policy.Evidence evidence) { }
|
||||
public System.Security.Policy.Evidence DocumentEvidence { get { throw null; } set { } }
|
||||
public System.Text.Encoding Encoding { get { throw null; } set { } }
|
||||
public System.Security.Cryptography.CipherMode Mode { get { throw null; } set { } }
|
||||
public System.Security.Cryptography.PaddingMode Padding { get { throw null; } set { } }
|
||||
|
||||
@@ -9,7 +9,10 @@
|
||||
<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'">
|
||||
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' != 'true'">
|
||||
<ProjectReference Include="..\..\System.Security.Permissions\ref\System.Security.Permissions.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' == 'true'">
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
@@ -20,4 +23,4 @@
|
||||
<Compile Include="System.Security.Cryptography.Xml.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -107,6 +107,7 @@
|
||||
<Reference Include="System.Security.Cryptography.Encoding" />
|
||||
<Reference Include="System.Security.Cryptography.Primitives" />
|
||||
<Reference Include="System.Security.Cryptography.X509Certificates" />
|
||||
<Reference Include="System.Security.Permissions" />
|
||||
<Reference Include="System.Text.Encoding.Extensions" />
|
||||
<Reference Include="System.Xml.ReaderWriter" />
|
||||
<Reference Include="System.Xml.XPath" />
|
||||
@@ -117,4 +118,4 @@
|
||||
<Reference Include="System.Security" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -2,13 +2,11 @@
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Security;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
||||
@@ -63,6 +61,7 @@ namespace System.Security.Cryptography.Xml
|
||||
//
|
||||
|
||||
private XmlDocument _document;
|
||||
private Evidence _evidence;
|
||||
private XmlResolver _xmlResolver;
|
||||
// hash table defining the key name mapping
|
||||
private const int _capacity = 4; // 4 is a reasonable capacity for
|
||||
@@ -80,9 +79,12 @@ namespace System.Security.Cryptography.Xml
|
||||
//
|
||||
public EncryptedXml() : this(new XmlDocument()) { }
|
||||
|
||||
public EncryptedXml(XmlDocument document)
|
||||
public EncryptedXml(XmlDocument document) : this(document, null) { }
|
||||
|
||||
public EncryptedXml(XmlDocument document, Evidence evidence)
|
||||
{
|
||||
_document = document;
|
||||
_evidence = evidence;
|
||||
_xmlResolver = null;
|
||||
// set the default padding to ISO-10126
|
||||
_padding = PaddingMode.ISO10126;
|
||||
@@ -95,7 +97,7 @@ namespace System.Security.Cryptography.Xml
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This mentod validates the _xmlDsigSearchDepthCounter counter
|
||||
/// This method validates the _xmlDsigSearchDepthCounter counter
|
||||
/// if the counter is over the limit defined by admin or developer.
|
||||
/// </summary>
|
||||
/// <returns>returns true if the limit has reached otherwise false</returns>
|
||||
@@ -123,6 +125,13 @@ namespace System.Security.Cryptography.Xml
|
||||
}
|
||||
}
|
||||
|
||||
// The evidence of the document being loaded: will be used to resolve external URIs
|
||||
public Evidence DocumentEvidence
|
||||
{
|
||||
get { return _evidence; }
|
||||
set { _evidence = value; }
|
||||
}
|
||||
|
||||
// The resolver to use for external entities
|
||||
public XmlResolver Resolver
|
||||
{
|
||||
@@ -207,7 +216,7 @@ namespace System.Security.Cryptography.Xml
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new CryptographicException(SR.Cryptography_Xml_UriNotResolved, cipherData.CipherReference.Uri);
|
||||
throw new CryptographicException(SR.Cryptography_Xml_UriNotResolved, cipherData.CipherReference.Uri);
|
||||
}
|
||||
// read the output stream into a memory stream
|
||||
byte[] cipherValue = null;
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace System.Security.Cryptography.Xml
|
||||
BeginCanonicalization,
|
||||
|
||||
/// <summary>
|
||||
/// Verificaiton of the signature format itself is beginning
|
||||
/// Verification of the signature format itself is beginning
|
||||
/// </summary>
|
||||
BeginCheckSignatureFormat,
|
||||
|
||||
@@ -544,10 +544,10 @@ namespace System.Security.Cryptography.Xml
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Log namespaces which are being propigated into the singature
|
||||
/// Log namespaces which are being propagated into the signature
|
||||
/// </summary>
|
||||
/// <param name="signedXml">SignedXml doing the signing or verification</param>
|
||||
/// <param name="namespaces">namespaces being propigated</param>
|
||||
/// <param name="namespaces">namespaces being propagated</param>
|
||||
internal static void LogNamespacePropagation(SignedXml signedXml, XmlNodeList namespaces)
|
||||
{
|
||||
Debug.Assert(signedXml != null, "signedXml != null");
|
||||
@@ -903,7 +903,7 @@ namespace System.Security.Cryptography.Xml
|
||||
/// keyed hash algorithm
|
||||
/// </summary>
|
||||
/// <param name="signedXml">SignedXml object doing the verification</param>
|
||||
/// <param name="mac">hash algoirthm doing the verification</param>
|
||||
/// <param name="mac">hash algorithm doing the verification</param>
|
||||
/// <param name="actualHashValue">hash value of the signed info</param>
|
||||
/// <param name="signatureValue">raw signature value</param>
|
||||
internal static void LogVerifySignedInfo(SignedXml signedXml,
|
||||
@@ -1030,7 +1030,7 @@ namespace System.Security.Cryptography.Xml
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write informaiton when user hits the Signed XML recursion depth limit issue.
|
||||
/// Write information when user hits the Signed XML recursion depth limit issue.
|
||||
/// This is helpful in debugging this kind of issues.
|
||||
/// </summary>
|
||||
/// <param name="signedXml">SignedXml object verifying the signature</param>
|
||||
|
||||
@@ -10,11 +10,9 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
@@ -47,28 +45,47 @@ namespace System.Security.Cryptography.Xml.Tests
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly Encoding DefaultEncoding = Encoding.UTF8;
|
||||
private const CipherMode DefaultCipherMode = CipherMode.CBC;
|
||||
private const PaddingMode DefaultPaddingMode = PaddingMode.ISO10126;
|
||||
private const string DefaultRecipient = "";
|
||||
private static readonly XmlResolver DefaultXmlResolver = null;
|
||||
private const int DefaultXmlDSigSearchDepth = 20;
|
||||
|
||||
[Fact]
|
||||
public void Constructor_Default()
|
||||
{
|
||||
EncryptedXml encryptedXml = new EncryptedXml();
|
||||
Assert.Equal(Encoding.UTF8, encryptedXml.Encoding);
|
||||
Assert.Equal(CipherMode.CBC, encryptedXml.Mode);
|
||||
Assert.Equal(PaddingMode.ISO10126, encryptedXml.Padding);
|
||||
Assert.Equal(string.Empty, encryptedXml.Recipient);
|
||||
Assert.Equal(null, encryptedXml.Resolver);
|
||||
Assert.Equal(20, encryptedXml.XmlDSigSearchDepth);
|
||||
Assert.Equal(DefaultEncoding, encryptedXml.Encoding);
|
||||
Assert.Equal(DefaultCipherMode, encryptedXml.Mode);
|
||||
Assert.Equal(DefaultPaddingMode, encryptedXml.Padding);
|
||||
Assert.Equal(DefaultRecipient, encryptedXml.Recipient);
|
||||
Assert.Equal(DefaultXmlResolver, encryptedXml.Resolver);
|
||||
Assert.Equal(DefaultXmlDSigSearchDepth, encryptedXml.XmlDSigSearchDepth);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_XmlDocument()
|
||||
{
|
||||
EncryptedXml encryptedXml = new EncryptedXml(null);
|
||||
Assert.Equal(Encoding.UTF8, encryptedXml.Encoding);
|
||||
Assert.Equal(CipherMode.CBC, encryptedXml.Mode);
|
||||
Assert.Equal(PaddingMode.ISO10126, encryptedXml.Padding);
|
||||
Assert.Equal(string.Empty, encryptedXml.Recipient);
|
||||
Assert.Equal(null, encryptedXml.Resolver);
|
||||
Assert.Equal(20, encryptedXml.XmlDSigSearchDepth);
|
||||
Assert.Equal(DefaultEncoding, encryptedXml.Encoding);
|
||||
Assert.Equal(DefaultCipherMode, encryptedXml.Mode);
|
||||
Assert.Equal(DefaultPaddingMode, encryptedXml.Padding);
|
||||
Assert.Equal(DefaultRecipient, encryptedXml.Recipient);
|
||||
Assert.Equal(DefaultXmlResolver, encryptedXml.Resolver);
|
||||
Assert.Equal(DefaultXmlDSigSearchDepth, encryptedXml.XmlDSigSearchDepth);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Constructor_XmlDocumentAndEvidence()
|
||||
{
|
||||
EncryptedXml encryptedXml = new EncryptedXml(null, null);
|
||||
Assert.Equal(DefaultEncoding, encryptedXml.Encoding);
|
||||
Assert.Equal(DefaultCipherMode, encryptedXml.Mode);
|
||||
Assert.Equal(DefaultPaddingMode, encryptedXml.Padding);
|
||||
Assert.Equal(DefaultRecipient, encryptedXml.Recipient);
|
||||
Assert.Equal(DefaultXmlResolver, encryptedXml.Resolver);
|
||||
Assert.Equal(DefaultXmlDSigSearchDepth, encryptedXml.XmlDSigSearchDepth);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
||||
@@ -54,9 +54,6 @@
|
||||
<Compile Include="XmlDsigXsltTransformTest.cs" />
|
||||
<Compile Include="XmlLicenseEncryptedRef.cs" />
|
||||
<Compile Include="XmlLicenseTransformTest.cs" />
|
||||
<Compile Include="$(CommonTestPath)\System\PlatformDetection.cs">
|
||||
<Link>Common\System\PlatformDetection.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="EncryptedXmlSample3.xml" />
|
||||
|
||||
Reference in New Issue
Block a user