Author: spouliot
Date: 2006-11-08 09:48:57 -0500 (Wed, 08 Nov 2006)
New Revision: 67532

Modified:
   
trunk/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeDeformatter.cs
   trunk/mcs/class/Mono.Security/Mono.Security.Authenticode/ChangeLog
Log:
2006-11-08  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * AuthenticodeDeformatter.cs: Return (find) the SigningCertificate 
        even if the signature isn't verifiable. This is the behaviour required
        for 2.0.



Modified: 
trunk/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeDeformatter.cs
===================================================================
--- 
trunk/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeDeformatter.cs
 2006-11-08 14:48:16 UTC (rev 67531)
+++ 
trunk/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeDeformatter.cs
 2006-11-08 14:48:57 UTC (rev 67532)
@@ -212,7 +212,6 @@
 
                        if (!signedHash.CompareValue (hash)) {
                                reason = 2;
-                               return false;
                        }
 
                        // messageDigest is a hash of spcIndirectDataContext 
(which includes the file hash)
@@ -220,7 +219,8 @@
                        ha.Initialize (); // re-using hash instance
                        byte[] messageDigest = ha.ComputeHash (spcIDC);
 
-                       return VerifySignature (sd, messageDigest, ha);
+                       bool sign = VerifySignature (sd, messageDigest, ha);
+                       return (sign && (reason == 0));
                }
 
                private bool CompareIssuerSerial (string issuer, byte[] serial, 
X509Certificate x509) 
@@ -306,11 +306,13 @@
                                if (CompareIssuerSerial (issuer, serial, x509)) 
{
                                        // don't verify is key size don't match
                                        if (x509.PublicKey.Length > 
(signature.Length >> 3)) {
+                                               // return the signing 
certificate even if the signature isn't correct
+                                               // (required behaviour for 2.0 
support)
+                                               signingCertificate = x509;
                                                RSACryptoServiceProvider rsa = 
(RSACryptoServiceProvider) x509.RSA;
                                                if (rsa.VerifyHash (p7hash, 
hashOID, signature)) {
                                                        
signerChain.LoadCertificates (coll);
                                                        trustedRoot = 
signerChain.Build (x509);
-                                                       signingCertificate = 
x509;
                                                        break; 
                                                }
                                        }

Modified: trunk/mcs/class/Mono.Security/Mono.Security.Authenticode/ChangeLog
===================================================================
--- trunk/mcs/class/Mono.Security/Mono.Security.Authenticode/ChangeLog  
2006-11-08 14:48:16 UTC (rev 67531)
+++ trunk/mcs/class/Mono.Security/Mono.Security.Authenticode/ChangeLog  
2006-11-08 14:48:57 UTC (rev 67532)
@@ -1,3 +1,9 @@
+2006-11-08  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * AuthenticodeDeformatter.cs: Return (find) the SigningCertificate 
+       even if the signature isn't verifiable. This is the behaviour required
+       for 2.0.
+
 2006-06-14  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * AuthenticodeBase.cs: Fix destination offset. Note that this works 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to