You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.22
Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
parent
5f4a27cc8a
commit
7d05485754
@ -33,11 +33,10 @@ namespace MonoTests.System.Security.Cryptography.Xml {
|
||||
{
|
||||
Assert.IsNull (reference.Uri, "Uri (null)");
|
||||
Assert.IsNotNull (reference.TransformChain, "TransformChain");
|
||||
Assert.AreEqual ("System.Security.Cryptography.Xml.Reference", reference.ToString (), "ToString()");
|
||||
// test uri constructor
|
||||
string uri = "uri";
|
||||
reference = new Reference (uri);
|
||||
Assert.AreEqual ("http://www.w3.org/2000/09/xmldsig#sha1", reference.DigestMethod, "DigestMethod");
|
||||
Assert.AreEqual (SignedXml.XmlDsigSHA256Url, reference.DigestMethod, "DigestMethod");
|
||||
Assert.IsNull (reference.DigestValue, "DigestValue");
|
||||
Assert.IsNull (reference.Id, "Id");
|
||||
Assert.IsNull (reference.Type, "Type");
|
||||
@ -158,17 +157,10 @@ namespace MonoTests.System.Security.Cryptography.Xml {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotDotNet")]
|
||||
// MS throws a NullReferenceException (reported as FDBK25886) but only when executed in NUnit
|
||||
// http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=3596d1e3-362b-40bd-bca9-2e8be75261ff
|
||||
public void AddAllTransforms ()
|
||||
{
|
||||
// adding an empty hash value
|
||||
byte[] hash = new byte [20];
|
||||
reference.DigestValue = hash;
|
||||
XmlElement xel = reference.GetXml ();
|
||||
// this is the minimal Reference (DigestValue)!
|
||||
Assert.IsNotNull (xel, "GetXml");
|
||||
reference.DigestMethod = SignedXml.XmlDsigSHA1Url;
|
||||
reference.DigestValue = new byte [20];
|
||||
|
||||
reference.AddTransform (new XmlDsigBase64Transform ());
|
||||
reference.AddTransform (new XmlDsigC14NTransform ());
|
||||
@ -177,13 +169,8 @@ namespace MonoTests.System.Security.Cryptography.Xml {
|
||||
reference.AddTransform (new XmlDsigXPathTransform ());
|
||||
reference.AddTransform (new XmlDsigXsltTransform ());
|
||||
|
||||
// MS's results
|
||||
string test1 = "<Reference xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#base64\" /><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments\" /><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\" /><Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xpath-19991116\"><XPath></XPath></Transform><Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xslt-19991116\" /></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>AAAAAAAAAAAAAAAAAAAAAAAAAAA=</DigestValue></Reference>";
|
||||
// Mono's result (xml is equivalent but not identical)
|
||||
string test2 = test1.Replace ("<XPath></XPath>", "<XPath xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />");
|
||||
string result = reference.GetXml().OuterXml;
|
||||
Assert.IsTrue (((result == test1) || (result == test2)), result);
|
||||
// however this value cannot be loaded as it's missing some transform (xslt) parameters
|
||||
const string expected = "<Reference xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#base64\" /><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments\" /><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\" /><Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xpath-19991116\"><XPath /></Transform><Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xslt-19991116\" /></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>AAAAAAAAAAAAAAAAAAAAAAAAAAA=</DigestValue></Reference>";
|
||||
Assert.That (reference.GetXml ().OuterXml, Is.EqualTo (expected), "OuterXml");
|
||||
|
||||
// can we add them again ?
|
||||
reference.AddTransform (new XmlDsigBase64Transform ());
|
||||
|
@ -790,6 +790,7 @@ namespace MonoTests.System.Security.Cryptography.Xml {
|
||||
signedXml.SignedInfo.CanonicalizationMethod = SignedXml.XmlDsigExcC14NTransformUrl;
|
||||
|
||||
Reference reference = new Reference ();
|
||||
reference.DigestMethod = SignedXml.XmlDsigSHA1Url;
|
||||
reference.Uri = "";
|
||||
|
||||
XmlDsigEnvelopedSignatureTransform env = new XmlDsigEnvelopedSignatureTransform ();
|
||||
|
@ -157,7 +157,6 @@ namespace MonoTests.System.Security.Cryptography.Xml {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotDotNet")]
|
||||
// see LoadInputAsXmlNodeList2 description
|
||||
public void LoadInputAsXmlNodeList ()
|
||||
{
|
||||
@ -166,11 +165,10 @@ namespace MonoTests.System.Security.Cryptography.Xml {
|
||||
transform.LoadInput (doc.ChildNodes);
|
||||
Stream s = (Stream) transform.GetOutput ();
|
||||
string output = Stream2String (s);
|
||||
Assert.AreEqual ("<Test></Test>", output, "XmlChildNodes");
|
||||
Assert.AreEqual ("<Test xmlns=\"http://www.go-mono.com/\"></Test>", output, "XmlChildNodes");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotDotNet")]
|
||||
// MS has a bug that those namespace declaration nodes in
|
||||
// the node-set are written to output. Related spec section is:
|
||||
// http://www.w3.org/TR/2001/REC-xml-c14n-20010315#ProcessingModel
|
||||
@ -180,7 +178,7 @@ namespace MonoTests.System.Security.Cryptography.Xml {
|
||||
transform.LoadInput (doc.SelectNodes ("//*"));
|
||||
Stream s = (Stream) transform.GetOutput ();
|
||||
string output = Stream2String (s);
|
||||
string expected = @"<Test><Toto></Toto></Test>";
|
||||
string expected = "<Test xmlns=\"http://www.go-mono.com/\"><Toto></Toto></Test>";
|
||||
Assert.AreEqual (expected, output, "XmlChildNodes");
|
||||
}
|
||||
|
||||
@ -507,20 +505,6 @@ namespace MonoTests.System.Security.Cryptography.Xml {
|
||||
Assert.AreEqual (xml, output);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PrefixlessNamespaceOutput ()
|
||||
{
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.AppendChild (doc.CreateElement ("foo", "urn:foo"));
|
||||
doc.DocumentElement.AppendChild (doc.CreateElement ("bar", "urn:bar"));
|
||||
Assert.AreEqual (String.Empty, doc.DocumentElement.GetAttribute ("xmlns"), "#1");
|
||||
XmlDsigC14NTransform t = new XmlDsigC14NTransform ();
|
||||
t.LoadInput (doc);
|
||||
Stream s = t.GetOutput () as Stream;
|
||||
Assert.AreEqual (new StreamReader (s, Encoding.UTF8).ReadToEnd (), "<foo xmlns=\"urn:foo\"><bar xmlns=\"urn:bar\"></bar></foo>");
|
||||
Assert.AreEqual ("urn:foo", doc.DocumentElement.GetAttribute ("xmlns"), "#2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore ("find out how PropagatedNamespaces returns non-null instance on .NET")]
|
||||
public void PropagatedNamespaces ()
|
||||
|
@ -251,7 +251,6 @@ namespace MonoTests.System.Security.Cryptography.Xml {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotDotNet")]
|
||||
// see LoadInputAsXmlNodeList2 description
|
||||
public void LoadInputAsXmlNodeList ()
|
||||
{
|
||||
@ -260,11 +259,10 @@ namespace MonoTests.System.Security.Cryptography.Xml {
|
||||
transform.LoadInput (doc.ChildNodes);
|
||||
Stream s = (Stream) transform.GetOutput ();
|
||||
string output = Stream2String (s);
|
||||
Assert.AreEqual ("<Test></Test>", output, "XmlChildNodes");
|
||||
Assert.AreEqual ("<Test xmlns=\"http://www.go-mono.com/\"></Test>", output, "XmlChildNodes");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotDotNet")]
|
||||
// MS has a bug that those namespace declaration nodes in
|
||||
// the node-set are written to output. Related spec section is:
|
||||
// http://www.w3.org/TR/2001/REC-xml-c14n-20010315#ProcessingModel
|
||||
@ -274,7 +272,7 @@ namespace MonoTests.System.Security.Cryptography.Xml {
|
||||
transform.LoadInput (doc.SelectNodes ("//*"));
|
||||
Stream s = (Stream) transform.GetOutput ();
|
||||
string output = Stream2String (s);
|
||||
string expected = @"<Test><Toto></Toto></Test>";
|
||||
string expected = "<Test xmlns=\"http://www.go-mono.com/\"><Toto></Toto></Test>";
|
||||
Assert.AreEqual (expected, output, "XmlChildNodes");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user