[Mono-bugs] [Bug 79269][Nor] New - NRE in RSACryptoServiceProvider.Decrypt() for X509Certificate2.PrivateKey

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Sep 4 05:01:35 EDT 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by atsushi at ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=79269

--- shadow/79269	2006-09-04 05:01:35.000000000 -0400
+++ shadow/79269.tmp.25418	2006-09-04 05:01:35.000000000 -0400
@@ -0,0 +1,77 @@
+Bug#: 79269
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: sebastien at ximian.com                            
+ReportedBy: atsushi at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: NRE in RSACryptoServiceProvider.Decrypt() for X509Certificate2.PrivateKey
+
+The following code causes a NullReferenceException with the attached
+certificate.
+
+using System;
+using System.Security.Cryptography;
+using System.Security.Cryptography.X509Certificates;
+
+public class Test
+{
+        public static void Main ()
+        {
+                X509Certificate2 cert =
+                        new X509Certificate2 ("test.pfx", "mono");
+                RSACryptoServiceProvider csp =
+                        (RSACryptoServiceProvider) cert.PrivateKey;
+                string b64 = @"YgyAhscnTTIcDeLJTZcOYYyHVxNhV6d03jeZYjq0
+sPMEsfCCbE/NcFyYHD9BTuiduqPplCLbGpfZIZYJ6vAP9m5z4Q9eEw79kmEFCsm8wSKEo/g
+KiptVpwQ78VOPrWd/wEkTTeeg2nVim3JIsTKGFlV7rKxIWQhGN9aAqgP8nZI=";
+                byte [] bytes = Convert.FromBase64String (b64);
+                csp.Decrypt (bytes, true);
+        }
+}
+
+
+Actual Results:
+
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+  at Mono.Math.BigInteger+ModulusRing.OddPow (Mono.Math.BigInteger b,
+Mono.Math.BigInteger exp) [0x00000]
+  at Mono.Math.BigInteger+ModulusRing.Pow (Mono.Math.BigInteger b,
+Mono.Math.BigInteger exp) [0x00000]
+  at Mono.Math.BigInteger.ModPow (Mono.Math.BigInteger exp,
+Mono.Math.BigInteger n) [0x00000]
+  at Mono.Security.Cryptography.RSAManaged.DecryptValue (System.Byte[] rgb)
+[0x00000]
+  at Mono.Security.Cryptography.PKCS1.RSADP
+(System.Security.Cryptography.RSA rsa, System.Byte[] c) [0x00000]
+  at Mono.Security.Cryptography.PKCS1.Decrypt_OAEP
+(System.Security.Cryptography.RSA rsa,
+System.Security.Cryptography.HashAlgorithm hash, System.Byte[] C) [0x00000]
+  at
+System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter.DecryptKeyExchange
+(System.Byte[] rgbData) [0x00000]
+  at System.Security.Cryptography.RSACryptoServiceProvider.Decrypt
+(System.Byte[] rgb, Boolean fOAEP) [0x00000]
+  at Test.Main () [0x00000]
+
+Expected Results:
+
+no error.
+
+How often does this happen? 
+
+consistently.
+
+Additional Information:
+
+The certificate is created by our makecert.exe (makecert -p12 test.pfx mono).


More information about the mono-bugs mailing list