Author: spouliot
Date: 2006-12-04 14:28:59 -0500 (Mon, 04 Dec 2006)
New Revision: 68984

Modified:
   trunk/mcs/class/Mono.Security/Mono.Security.X509/ChangeLog
   trunk/mcs/class/Mono.Security/Mono.Security.X509/X509Certificate.cs
Log:
2006-12-04  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * X509Certificate.cs: Added support for inherited DSA key parameters.



Modified: trunk/mcs/class/Mono.Security/Mono.Security.X509/ChangeLog
===================================================================
--- trunk/mcs/class/Mono.Security/Mono.Security.X509/ChangeLog  2006-12-04 
18:46:48 UTC (rev 68983)
+++ trunk/mcs/class/Mono.Security/Mono.Security.X509/ChangeLog  2006-12-04 
19:28:59 UTC (rev 68984)
@@ -1,3 +1,7 @@
+2006-12-04  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * X509Certificate.cs: Added support for inherited DSA key parameters.
+
 2006-11-22  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * X509Store.cs: Add new Open method to access any certificate store

Modified: trunk/mcs/class/Mono.Security/Mono.Security.X509/X509Certificate.cs
===================================================================
--- trunk/mcs/class/Mono.Security/Mono.Security.X509/X509Certificate.cs 
2006-12-04 18:46:48 UTC (rev 68983)
+++ trunk/mcs/class/Mono.Security/Mono.Security.X509/X509Certificate.cs 
2006-12-04 19:28:59 UTC (rev 68984)
@@ -244,6 +244,9 @@
 
                public DSA DSA {
                        get {
+                               if (m_keyalgoparams == null)
+                                       throw new CryptographicException 
("Missing key algorithm parameters.");
+
                                if (_dsa == null) {
                                        DSAParameters dsaParams = new 
DSAParameters ();
                                        // for DSA m_publickey contains 1 ASN.1 
integer - Y
@@ -329,6 +332,7 @@
                                        return null;
                                return (byte[]) m_keyalgoparams.Clone (); 
                        }
+                       set { m_keyalgoparams = value; }
                }
 
                public virtual byte[] PublicKey {
@@ -406,12 +410,17 @@
                                                ASN1 sign = new ASN1 
(signature);
                                                if ((sign == null) || 
(sign.Count != 2))
                                                        return null;
-                                               // parts may be less than 20 
bytes (i.e. first bytes were 0x00)
                                                byte[] part1 = sign [0].Value;
                                                byte[] part2 = sign [1].Value;
                                                byte[] sig = new byte [40];
-                                               Buffer.BlockCopy (part1, 0, 
sig, (20 - part1.Length), part1.Length);
-                                               Buffer.BlockCopy (part2, 0, 
sig, (40 - part2.Length), part2.Length);
+                                               // parts may be less than 20 
bytes (i.e. first bytes were 0x00)
+                                               // parts may be more than 20 
bytes (i.e. first byte > 0x80, negative)
+                                               int s1 = System.Math.Max (0, 
part1.Length - 20);
+                                               int e1 = System.Math.Max (0, 20 
- part1.Length);
+                                               Buffer.BlockCopy (part1, s1, 
sig, e1, part1.Length - s1);
+                                               int s2 = System.Math.Max (0, 
part2.Length - 20);
+                                               int e2 = System.Math.Max (20, 
40 - part2.Length);
+                                               Buffer.BlockCopy (part2, s2, 
sig, e2, part2.Length - s2);
                                                return sig;
 
                                        default:

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

Reply via email to