Author: spouliot
Date: 2006-09-05 14:21:57 -0400 (Tue, 05 Sep 2006)
New Revision: 64959

Modified:
   trunk/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog
   trunk/mcs/class/Mono.Security/Mono.Security.Cryptography/RSAManaged.cs
Log:
2006-09-05  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * RSAManaged.cs: Backport NRE fix from mscorlib.dll.



Modified: trunk/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog
===================================================================
--- trunk/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog  
2006-09-05 18:18:13 UTC (rev 64958)
+++ trunk/mcs/class/Mono.Security/Mono.Security.Cryptography/ChangeLog  
2006-09-05 18:21:57 UTC (rev 64959)
@@ -1,3 +1,7 @@
+2006-09-05  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * RSAManaged.cs: Backport NRE fix from mscorlib.dll.
+
 2006-06-15  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * CryptoTools.cs: Fix offset in block processor. This fix the HMAC

Modified: trunk/mcs/class/Mono.Security/Mono.Security.Cryptography/RSAManaged.cs
===================================================================
--- trunk/mcs/class/Mono.Security/Mono.Security.Cryptography/RSAManaged.cs      
2006-09-05 18:18:13 UTC (rev 64958)
+++ trunk/mcs/class/Mono.Security/Mono.Security.Cryptography/RSAManaged.cs      
2006-09-05 18:21:57 UTC (rev 64959)
@@ -7,7 +7,7 @@
 //
 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
 // Portions (C) 2003 Ben Maurer
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
 //
 // Key generation translated from Bouncy Castle JCE 
(http://www.bouncycastle.org/)
 // See bouncycastle.txt for license.
@@ -161,10 +161,10 @@
                        get { return "RSA-PKCS1-KeyEx"; }
                }
 
-               // note: this property will exist in RSACryptoServiceProvider in
-               // version 2.0 of the framework
+               // note: when (if) we generate a keypair then it will have both
+               // the public and private keys
                public bool PublicOnly {
-                       get { return ((d == null) || (n == null)); }
+                       get { return (keypairGenerated && ((d == null) || (n == 
null))); }
                }
 
                public override string SignatureAlgorithm {
@@ -210,9 +210,11 @@
                                        // m = m2 + q * h;
                                        output = m2 + q * h;
                                }
-                       } else {
+                       } else if (!PublicOnly) {
                                // m = c^d mod n
                                output = input.ModPow (d, n);
+                       } else {
+                               throw new CryptographicException 
(Locale.GetText ("Missing private key to decrypt value."));
                        }
 
                        if (keyBlinding) {

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

Reply via email to