Do not throw in IsSelfSigned on non-RSA based certificates
authorSebastien Pouliot <sebastien@ximian.com>
Sun, 27 Mar 2011 20:54:02 +0000 (16:54 -0400)
committerSebastien Pouliot <sebastien@ximian.com>
Sun, 27 Mar 2011 20:54:02 +0000 (16:54 -0400)
* X509Certificate.cs: Handle DSA or DSA paramaters-only certificates
in IsSeldSigned

mcs/class/Mono.Security/Mono.Security.X509/X509Certificate.cs

index e951e4bede2236ba8f46dd06b7fc39a20229532d..c28e2f6bdbc5b5cf73462a2789fe58998c7c057a 100644 (file)
@@ -534,10 +534,20 @@ namespace Mono.Security.X509 {
 
                public bool IsSelfSigned {
                        get { 
-                               if (m_issuername == m_subject)
-                                       return VerifySignature (RSA); 
-                               else
+                               if (m_issuername != m_subject)
                                        return false;
+
+                               try {
+                                       if (RSA != null)
+                                               return VerifySignature (RSA);
+                                       else if (DSA != null)
+                                               return VerifySignature (DSA);
+                                       else
+                                               return false; // e.g. a certificate with only DSA parameters
+                               }
+                               catch (CryptographicException) {
+                                       return false;
+                               }
                        }
                }