[Mono-bugs] [Bug 79455][Nor] New - X509Certificate2 created from X509Certificate fails to get PublicKey

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Sep 20 13:49:42 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=79455

--- shadow/79455	2006-09-20 13:49:42.000000000 -0400
+++ shadow/79455.tmp.3559	2006-09-20 13:49:42.000000000 -0400
@@ -0,0 +1,66 @@
+Bug#: 79455
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System
+AssignedTo: sebastien at ximian.com                            
+ReportedBy: atsushi at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: X509Certificate2 created from X509Certificate fails to get PublicKey
+
+The following code tries to acquire PublicKey from X509Certificate2 which
+is instantiated from X509Certificate, and somehow causes crash.
+
+--------
+using System;
+using System.Security.Cryptography.X509Certificates;
+
+public class Test
+{
+        public static void Main ()
+        {
+                string s = @"MIIB+DCCAWECBETq5RIwDQYJKoZIhvcNAQEFBQAwQzELMAk
+GA1UEBhMCVVMxDDAKBgNVBAoTA1N1bjERMA8GA1UECxMISmF2YVNvZnQxEzARBgNVBAMTCk1hcms
+gSm9uZXMwHhcNMDYwODIyMTEwNTU0WhcNMDYxMTIwMTEwNTU0WjBDMQswCQYDVQQGEwJVUzEMMAo
+GA1UEChMDU3VuMREwDwYDVQQLEwhKYXZhU29mdDETMBEGA1UEAxMKTWFyayBKb25lczCBnzANBgk
+qhkiG9w0BAQEFAAOBjQAwgYkCgYEAuF7Nq9xk49Kvw3jjFMPMxoOcZaarM+ODwtvrQpgmaFrA3U6
+m3bLkM6gX8QyZJF0cYasyplyPlUB0BW2FmniyGPVGgbeEKI7bUCGTSVOulS6bYGG6i30zVUt0Xel
+e4O5A2ccNf8/P0+AUPeUe8J0NLql0OeFLLGWQ2MltC+m0RPMCAwEAATANBgkqhkiG9w0BAQUFAAO
+BgQCVhGrJgVEvmgRWMRI6LS6r8twZQwU9KBjNuY3Y5tYpwoTj5/GAFzMYksQ+8qtVCjNr39Ksi4h
++FcoRYRJ8XVfLCKbEHV4QEGt8eQlSyhFDrovF25r4D9t0GAbB5VS4QCmAAtetWoygZsM52dDVOnb
+uz3wy1KrF9i2aRixqm+LqBg==";
+                byte [] raw = Convert.FromBase64String (s);
+                X509Certificate cert = new X509Certificate (raw);
+                Console.WriteLine (new X509Certificate2 (cert).PublicKey.Key);
+                //Console.WriteLine (new X509Certificate2 (raw).PublicKey.Key);
+        }
+}
+
+... while the commented line works fine (it tries to create
+X509Certificate2 from the raw bytes).
+
+
+Actual Results:
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+  at Mono.Security.ASN1..ctor (System.Byte[] data) [0x00000]
+  at Mono.Security.X509.X509Certificate.get_DSA () [0x00000]
+  at System.Security.Cryptography.X509Certificates.PublicKey..ctor
+(Mono.Security.X509.X509Certificate certificate) [0x00000]
+  at
+System.Security.Cryptography.X509Certificates.X509Certificate2.get_PublicKey
+() [0x00000]
+  at Test.Main () [0x00000]
+
+
+Expected Results:
+
+no error.


More information about the mono-bugs mailing list