2006-01-05 Sebastien Pouliot <sebastien@ximian.com>
authorSebastien Pouliot <sebastien@ximian.com>
Thu, 5 Jan 2006 16:07:07 +0000 (16:07 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Thu, 5 Jan 2006 16:07:07 +0000 (16:07 -0000)
* X509Extension.cs: Extension data may be encapsulated (i.e. ASN.1
data inside the octet string) if it comes from the X509Certificate
parser.

svn path=/trunk/mcs/; revision=55105

mcs/class/Mono.Security/Mono.Security.X509/ChangeLog
mcs/class/Mono.Security/Mono.Security.X509/X509Extension.cs

index d557d45dcd5cbd34a2fc68bc545b8e27cee3bab3..c85aaabe4d7d686a7c5dc24234b7a3da6ddc78d6 100644 (file)
@@ -1,3 +1,9 @@
+2006-01-05  Sebastien Pouliot  <sebastien@ximian.com>
+
+       * X509Extension.cs: Extension data may be encapsulated (i.e. ASN.1
+       data inside the octet string) if it comes from the X509Certificate 
+       parser.
+
 2006-01-04  Sebastien Pouliot  <sebastien@ximian.com>
 
        * X509Extension.cs: Added setter for Critical property (fix #77154).
index 697a55e79c9af71f7fc233eee94e59b9e778ad96..637e74b48cd20d7bb065966fceb941f6f7c1dac5 100644 (file)
@@ -66,7 +66,18 @@ namespace Mono.Security.X509 {
 
                        extnOid = ASN1Convert.ToOid (asn1[0]);
                        extnCritical = ((asn1[1].Tag == 0x01) && (asn1[1].Value[0] == 0xFF));
-                       extnValue = asn1 [asn1.Count - 1]; // last element
+                       // last element is an octet string which may need to be decoded
+                       extnValue = asn1 [asn1.Count - 1];
+                       if ((extnValue.Tag == 0x04) && (extnValue.Length > 0) && (extnValue.Count == 0)) {
+                               try {
+                                       ASN1 encapsulated = new ASN1 (extnValue.Value);
+                                       extnValue.Value = null;
+                                       extnValue.Add (encapsulated);
+                               }
+                               catch {
+                                       // data isn't ASN.1
+                               }
+                       }
                        Decode ();
                }