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:
authorAtsushi Eno <atsushieno@gmail.com>2006-09-20 21:58:51 +0400
committerAtsushi Eno <atsushieno@gmail.com>2006-09-20 21:58:51 +0400
commita09f566ab1cd8b05d826ca6b69433fe1fc3a26f4 (patch)
tree01bec6e5af668d4525cb0cc87b1d18f42ae7067f /mcs/class/System.Security/System.Security.Cryptography.Xml
parent8e3f64f95e24629dfd7063d4b198d8aee6286fe4 (diff)
2006-09-20 Atsushi Enomoto <atsushi@ximian.com>
* SignedXml.cs : overwrite my fix with Gert's patch on #79454 to make it possible to handle multiple certificates. svn path=/trunk/mcs/; revision=65732
Diffstat (limited to 'mcs/class/System.Security/System.Security.Cryptography.Xml')
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog5
-rw-r--r--mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs36
2 files changed, 31 insertions, 10 deletions
diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog b/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
index 66f417a6dee..ddc0220a555 100644
--- a/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
@@ -1,5 +1,10 @@
2006-09-20 Atsushi Enomoto <atsushi@ximian.com>
+ * SignedXml.cs : overwrite my fix with Gert's patch on #79454 to make it
+ possible to handle multiple certificates.
+
+2006-09-20 Atsushi Enomoto <atsushi@ximian.com>
+
* SignedXml.cs : handle KeyInfoX509Data in GetPublicKey(). Fixed #1 of
bug #79454.
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 50718164a58..4d30baa407f 100644
--- a/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs
+++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs
@@ -85,7 +85,10 @@ namespace System.Security.Cryptography.Xml {
private XmlResolver xmlResolver = new XmlUrlResolver ();
#endif
private ArrayList manifests;
-
+#if NET_2_0
+ private IEnumerator _x509Enumerator;
+#endif
+
private static readonly char [] whitespaceChars = new char [] {' ', '\r', '\n', '\t'};
public SignedXml ()
@@ -680,18 +683,21 @@ namespace System.Security.Cryptography.Xml {
if (pkEnumerator == null) {
pkEnumerator = m_signature.KeyInfo.GetEnumerator ();
}
-
- if (pkEnumerator.MoveNext ()) {
- AsymmetricAlgorithm key = null;
- KeyInfoClause kic = (KeyInfoClause) pkEnumerator.Current;
-
+
#if NET_2_0
- if (kic is KeyInfoX509Data) {
- foreach (X509Certificate cert in ((KeyInfoX509Data) kic).Certificates)
- // FIXME: this GetRawCertData() should not be required, but it somehow causes crash.
- return new X509Certificate2 (cert.GetRawCertData ()).PublicKey.Key;
+ if (_x509Enumerator != null) {
+ if (_x509Enumerator.MoveNext ()) {
+ X509Certificate cert = (X509Certificate) _x509Enumerator.Current;
+ return new X509Certificate2 (cert.GetRawCertData ()).PublicKey.Key;
+ } else {
+ _x509Enumerator = null;
}
+ }
#endif
+ while (pkEnumerator.MoveNext ()) {
+ AsymmetricAlgorithm key = null;
+ KeyInfoClause kic = (KeyInfoClause) pkEnumerator.Current;
+
if (kic is DSAKeyValue)
key = DSA.Create ();
else if (kic is RSAKeyValue)
@@ -701,6 +707,16 @@ namespace System.Security.Cryptography.Xml {
key.FromXmlString (kic.GetXml ().InnerXml);
return key;
}
+
+#if NET_2_0
+ if (kic is KeyInfoX509Data) {
+ _x509Enumerator = ((KeyInfoX509Data) kic).Certificates.GetEnumerator ();
+ if (_x509Enumerator.MoveNext ()) {
+ X509Certificate cert = (X509Certificate) _x509Enumerator.Current;
+ return new X509Certificate2 (cert.GetRawCertData ()).PublicKey.Key;
+ }
+ }
+#endif
}
return null;
}