Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Pouliot <sebastien@ximian.com>2005-05-04 20:21:08 +0400
committerSebastien Pouliot <sebastien@ximian.com>2005-05-04 20:21:08 +0400
commit5faed2987bd5ffc8597d44d1a68fc6ad2edbf8b2 (patch)
tree0b1838e3ccd6834c9f8f0ea307d13f03c2e1cbc4 /mcs/class/System.Security/System.Security.Cryptography.Xml
parent5a75904c3180e67ea47f8a74a7480985b3449633 (diff)
2005-05-04 Sebastien Pouliot <sebastien@ximian.com>
* SignedXml.cs: Return an empty (not null) KeyInfo by default and don't throw a CryptographicException in CheckSignature (both NET_2_0). * KeyInfoRetrievalMethod.cs: Don't include an empty URI attribute in the XML output for NET_2_0. * XmlDsigXPathTransform.cs: Throw an XPathException in NET_2_0 if no xpath expression has been supplied to the transform. svn path=/trunk/mcs/; revision=44034
Diffstat (limited to 'mcs/class/System.Security/System.Security.Cryptography.Xml')
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog9
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoRetrievalMethod.cs7
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs20
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs10
4 files changed, 33 insertions, 13 deletions
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog b/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
index 4a20c2bbcc8..750f48e24a0 100644
--- a/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
@@ -1,3 +1,12 @@
+2005-05-04 Sebastien Pouliot <sebastien@ximian.com>
+
+ * SignedXml.cs: Return an empty (not null) KeyInfo by default and
+ don't throw a CryptographicException in CheckSignature (both NET_2_0).
+ * KeyInfoRetrievalMethod.cs: Don't include an empty URI attribute
+ in the XML output for NET_2_0.
+ * XmlDsigXPathTransform.cs: Throw an XPathException in NET_2_0 if no
+ xpath expression has been supplied to the transform.
+
2005-05-03 Sebastien Pouliot <sebastien@ximian.com>
* XmlDsigXsltTransform.cs: Fixed 2 test cases (that nows throws
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoRetrievalMethod.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoRetrievalMethod.cs
index 17c87f5ce1a..712f7ddd466 100644
--- a/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoRetrievalMethod.cs
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoRetrievalMethod.cs
@@ -84,11 +84,14 @@ namespace System.Security.Cryptography.Xml {
XmlDocument document = new XmlDocument ();
XmlElement xel = document.CreateElement (XmlSignature.ElementNames.RetrievalMethod, XmlSignature.NamespaceURI);
- if (URI != null)
- xel.SetAttribute (XmlSignature.AttributeNames.URI, URI);
#if NET_2_0
+ if ((URI != null) && (URI.Length > 0))
+ xel.SetAttribute (XmlSignature.AttributeNames.URI, URI);
if (Type != null)
xel.SetAttribute (XmlSignature.AttributeNames.Type, Type);
+#else
+ if (URI != null)
+ xel.SetAttribute (XmlSignature.AttributeNames.URI, URI);
#endif
return xel;
}
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs
index 997136ee2c6..ef8f1895489 100644
--- a/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs
@@ -119,7 +119,13 @@ namespace System.Security.Cryptography.Xml {
#endif
public KeyInfo KeyInfo {
- get { return m_signature.KeyInfo; }
+ get {
+#if NET_2_0
+ if (m_signature.KeyInfo == null)
+ m_signature.KeyInfo = new KeyInfo ();
+#endif
+ return m_signature.KeyInfo;
+ }
set { m_signature.KeyInfo = value; }
}
@@ -156,10 +162,6 @@ namespace System.Security.Cryptography.Xml {
public void AddObject (DataObject dataObject)
{
-#if NET_2_0
- if (dataObject == null)
- throw new ArgumentNullException ("dataObject");
-#endif
m_signature.AddObject (dataObject);
}
@@ -480,10 +482,14 @@ namespace System.Security.Cryptography.Xml {
// check with supplied key
if (!CheckSignatureWithKey (key))
return null;
- }
- else {
+ } else {
+#if NET_2_0
+ if (Signature.KeyInfo == null)
+ return null;
+#else
if (Signature.KeyInfo == null)
throw new CryptographicException ("At least one KeyInfo is required.");
+#endif
// no supplied key, iterates all KeyInfo
while ((key = GetPublicKey ()) != null) {
if (CheckSignatureWithKey (key)) {
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs
index 50373d18924..8208bf12a40 100644
--- a/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs
@@ -8,9 +8,7 @@
// Atsushi Enomoto <atsushi@ximian.com>
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// (C) 2004 Novell (http://www.novell.com)
-//
-
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -100,9 +98,13 @@ namespace System.Security.Cryptography.Xml
[MonoTODO ("Evaluation of extension function here() results in different from MS.NET (is MS.NET really correct??).")]
public override object GetOutput ()
{
+#if NET_2_0
+ if (xpath == null)
+ throw new XPathException (Locale.GetText ("No XPath expression provided."));
+#else
if (xpath == null)
return new XmlDsigNodeList (new ArrayList ());
-
+#endif
// evaluate every time since input or xpath might have changed.
string x = null;
for (int i = 0; i < xpath.Count; i++) {