Subject: [TLS] Help with DER decoding of a CertificateExtension value

From: Robert Withers <[email-masked]>
Date: Tue, 20 Mar 2007 21:08:19 -0700

Hi,

I realize this is the wrong forum for this, but I hope someone may be  
able to help clarify this.  I was unable to find a working list for  
asn1.

I have a chunk of DER encoded bytes, which is the value of a  
CertificateExtension, that I am trying to decode.  I am getting  
something funny.  Here is the raw data:

30328210686F6D652E73656C666973682E6F7267A01E06082B06010505070805A0120C10 
686F6D652E73656C666973682E6F7267

I analyzed the structure when decoding and I get the following:

SEQUENCE = T(30) L(32) V(
	Implicit [2] = T(82) L(10) V(68 6F 6D 65 2E 73 65 6C 66 69 73 68 2E  
6F 72 67)
	Explicit [0] = T(A0) L(1E) V(
		OID = T(06) L(08) V(2B 06 01 05 05 07 08 05)
		Explicit [0] = T(A0) L(12) V(
			String = T(0C) L(10) V(68 6F 6D 65 2E 73 65 6C 66 69 73 68 2E 6F  
72 67))))

The outer is a SEQUENCE and is ok.  Inside, at the value of the first  
Explicit [0] Triplet, it is not a SEQUENCE, but it has 2 Triplets  
inside of it.  Looking at its Length (1E), it thinks it should be  
holding both Triplets.  Isn't that funny?

My code is only grabbing the first Triplet when decoding an Explicit  
[0], and then my outer Sequence is decoding the second inner Triplet,  
so I actually get:

Sequence (
	Implicit [2]
	Explicit [0] (OID)
	Explicit [0] (String))

instead of:

Sequence (
	Implicit [2]
	Explicit [0] (
		OID
		Explicit [0]))

The corresponding length of the first Explicit [0] is messed up when  
I re-encode it.  Plus there shouldn't be the same tag value ([0]) in  
the same scope, so they definitely seem nested.  Could someone help  
me make sense of this?

thanks,
Robert

_______________________________________________
TLS mailing list
[email-masked]
https://www1.ietf.org/mailman/listinfo/tls