[Mono-bugs] [Bug 78908][Maj] New - Byte ordering problem on SerialNumber when creating x509 certificate
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Thu Jul 20 10:35:21 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 informatique.internet at fiducial.fr.
http://bugzilla.ximian.com/show_bug.cgi?id=78908
--- shadow/78908 2006-07-20 10:35:21.000000000 -0400
+++ shadow/78908.tmp.29556 2006-07-20 10:35:21.000000000 -0400
@@ -0,0 +1,81 @@
+Bug#: 78908
+Product: Mono: Class Libraries
+Version: 1.1
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: Mono.Security
+AssignedTo: sebastien at ximian.com
+ReportedBy: informatique.internet at fiducial.fr
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Byte ordering problem on SerialNumber when creating x509 certificate
+
+Description of Problem:
+There's a problem with the X509CertificateBuilder class
+
+Steps to reproduce the problem:
+1. try this test case:
+using System;
+using System.IO;
+using Mono.Security.Authenticode;
+using Mono.Security;
+using Mono.Security.X509.Extensions;
+using Mono.Security.Cryptography;
+using System.Security.Cryptography;
+using System.Security.Cryptography.X509Certificates;
+
+namespace CertifBug
+{
+ class MainClass
+ {
+ public static void Main(string[] args)
+ {
+ Mono.Security.X509.X509CertificateBuilder cb = new
+Mono.Security.X509.X509CertificateBuilder (3);
+ Guid serial=Guid.NewGuid();
+ string serialnumber=serial.ToString();
+ cb.SerialNumber=serial.ToByteArray();
+ Console.WriteLine("sn : "+BitConverter.ToString(serial.ToByteArray()));
+ cb.IssuerName="CN=pipo";
+ cb.NotBefore=DateTime.Now;
+ cb.NotAfter=DateTime.MaxValue;
+ cb.SubjectName = "CN=pipo";
+ cb.SubjectPublicKey=RSA.Create();
+ ExtendedKeyUsageExtension eku = new ExtendedKeyUsageExtension();
+ eku.KeyPurpose.Add("1.3.6.1.5.5.7.3.2");
+ cb.Extensions.Add(eku);
+ cb.Hash = "SHA1";
+ byte[] rawcert=cb.Sign(RSA.Create());
+ //FileStream fs=new FileStream("./pipo.crt",FileMode.OpenOrCreate);
+ //fs.Write(rawcert,0,rawcert.Length);
+ //fs.Close();
+
+ X509Certificate cert=new X509Certificate(rawcert);
+ Console.WriteLine("sn : "+BitConverter.ToString(cert.GetSerialNumber()));
+ }
+
+ }
+}
+2.
+3.
+
+Actual Results:
+
+sn : 18-C6-1D-07-78-CA-F0-44-AB-B2-5C-73-EB-79-0C-60
+sn : 60-0C-79-EB-73-5C-B2-AB-44-F0-CA-78-07-1D-C6-18
+
+
+Expected Results:
+sn : 18-C6-1D-07-78-CA-F0-44-AB-B2-5C-73-EB-79-0C-60
+sn : 18-C6-1D-07-78-CA-F0-44-AB-B2-5C-73-EB-79-0C-60
+
+How often does this happen?
+always
+
+Additional Information:
More information about the mono-bugs
mailing list