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 [EMAIL PROTECTED]

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

--- shadow/79269        2006-09-04 05:02:49.000000000 -0400
+++ shadow/79269.tmp.9887       2006-09-05 10:11:20.000000000 -0400
@@ -1,23 +1,23 @@
 Bug#: 79269
 Product: Mono: Class Libraries
 Version: 1.1
-OS: 
+OS: unknown
 OS Details: 
-Status: NEW   
+Status: ASSIGNED   
 Resolution: 
-Severity: 
+Severity: Unknown
 Priority: Normal
 Component: CORLIB
 AssignedTo: [EMAIL PROTECTED]                            
 ReportedBy: [EMAIL PROTECTED]               
 QAContact: [EMAIL PROTECTED]
 TargetMilestone: ---
 URL: 
 Cc: 
-Summary: NRE in RSACryptoServiceProvider.Decrypt() for 
X509Certificate2.PrivateKey
+Summary: [2.0] NRE in RSACryptoServiceProvider.Decrypt() for 
X509Certificate2.PrivateKey
 
 The following code causes a NullReferenceException with the attached
 certificate.
 
 using System;
 using System.Security.Cryptography;
@@ -77,6 +77,44 @@
 The certificate is created by our makecert.exe (makecert -p12 test.pfx mono).
 
 ------- Additional Comments From [EMAIL PROTECTED]  2006-09-04 05:02 -------
 Created an attachment (id=17603)
 sample certificate loaded by the sample code.
 
+
+------- Additional Comments From [EMAIL PROTECTED]  2006-09-05 10:11 -------
+For some reason the private key didn't find it's way in the
+certificate instance, see updated source code on how to trap this
+issue (v2 specific).
+
+Not sure if the NRE is normal or not (i.e. compatible exception) but
+I'll look at it.
+
+Also note that all new X509 stuff available in v2 is unimplemented,
+incomplete and/or untested.
+
+
+// gmcs -debug 79269.cs
+
+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;
+               if (csp.PublicOnly) {
+                       Console.WriteLine ("private key is inaccessible");
+                       return;
+               }
+                string b64 =
+@"YgyAhscnTTIcDeLJTZcOYYyHVxNhV6d03jeZYjq0sPMEsfCCbE/NcFyYHD9BTuiduqPplCLbGpfZIZYJ6vAP9m5z4Q9eEw79kmEFCsm8wSKEo/gKiptVpwQ78VOPrWd/wEkTTeeg2nVim3JIsTKGFlV7rKxIWQhGN9aAqgP8nZI=";
+                byte [] bytes = Convert.FromBase64String (b64);
+                csp.Decrypt (bytes, true);
+        }
+}
+
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to