[Mono-list] Bugs in Mono.Security

Sebastien Pouliot sebastien.pouliot at gmail.com
Tue Jun 27 08:22:14 EDT 2006


Hello Galkin,

On Tue, 2006-06-27 at 15:39 +0400, Galkin Oleg wrote:
> Me and my buddy found several bugs in Mono.Security. Here are their descriptions:

Please fill each (individual) bug report into bugzilla at
http://bugzilla.ximian.com/
Bugs/patches on mailing-list tends to be forgotten more easily.

If possible, please use diff to submit patches and attach them to the
bug report.

> #1. Mono.Security.X509.X501
> 
> X520.AttributeTypeAndValue GetAttributeFromOid(string attributeType)
> The problem is in the folowing code line (approximately line 91):
> 
> //-----------------------Begin Code Snippet---------------------
> if (text1 == "OID.")
> //-----------------------End Code Snippet-----------------------
> 
> This bug causes error with adding irregular types of RDN values. 
> This line must be replaced with:
> 
> //-----------------------Begin Code Snippet---------------------
> if (text1.Substring(0,4) == "OID.")
> //-----------------------End Code Snippet-----------------------

Please include a (or some) test case(s) with the bug report. If possible
make it a patch for the unit test suite. This way this bug won't be,
directly or indirectly, re-introduced in future releases.

> #2 Internationalization problems with BMPString (Mono.Security.X509.X501.ToString())
> Mono.Security.X509.X520.GetASN1(byte encoding)
> In this method, BMPString type is encoded by BigEndianUnicode, but in
> Mono.Security.X509.X501.ToString() BMPString is decoded as "%20%
> 13...etc.". Why don't you use BigEndianUnicode to decode it?

SVN history would (probably) know. Maybe someone asked (or sent a patch)
for BMPString support without unit tests ;-)

Please also include some test cases for this bug.

> The Solution is:
> 
> Following lines in X501.ToString:
> 
> //-----------------------Begin Code Snippet---------------------
> StringBuilder builder2 = new StringBuilder();
> for (int num3 = 1; num3 < asn3.Value.Length; num3 += 2)
> {
>   builder2.Append((char)asn3.Value[num3]);
> }
> text1 = builder2.ToString();
> //-----------------------End Code Snippet-----------------------
> 
> replace with:
> 
> //-----------------------Begin Code Snippet---------------------
> text1 = Encoding.BigEndianUnicode.GetString(asn3.Value);
> //-----------------------End Code Snippet-----------------------

Thanks
-- 
Sebastien Pouliot  <sebastien at ximian.com>
Blog: http://pages.infinit.net/ctech/



More information about the Mono-list mailing list