2006-09-05 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Tue, 5 Sep 2006 13:52:18 +0000 (13:52 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Tue, 5 Sep 2006 13:52:18 +0000 (13:52 -0000)
* RSAManaged.cs: Fix a NRE when decrypting without a private key
(#79269). We now throw a CryptographicException with an appropriate
text message.

svn path=/trunk/mcs/; revision=64939

mcs/class/corlib/Mono.Security.Cryptography/ChangeLog
mcs/class/corlib/Mono.Security.Cryptography/RSAManaged.cs

index b2635ea3b8704d9ae4731b8b4c5c9991d52cc8f5..6aed92f0f897ac4dc0663993281d4380a21e279f 100644 (file)
@@ -1,3 +1,9 @@
+2006-09-05  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * RSAManaged.cs: Fix a NRE when decrypting without a private key 
+       (#79269). We now throw a CryptographicException with an appropriate
+       text message.
+
 2006-06-15  Sebastien Pouliot  <sebastien@ximian.com>
 
        * CryptoTools.cs: Fix offset in block processor. This fix the HMAC
index 8bbe49a5f3da7dcf6e2759415779c1cb8de60668..2778190b395787853ef13e136995a9a740361eb0 100644 (file)
@@ -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.
@@ -210,9 +210,11 @@ namespace Mono.Security.Cryptography {
                                        // 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) {