Hi, This is the reincarnation of an old question posted to this group. If I am using indefinite form of encoding, and my value itself needs to contain "00 00", then isn't the decoder confused when it sees the "00 00", as it could mean that it's the terminal marking end-of-value, or a part of the value ?
regards, bdutta -----Original Message----- From: Lev Walkin [mailto:[EMAIL PROTECTED] Sent: Sunday, February 27, 2005 9:01 AM To: Banibrata Dutta Cc: [email protected] Subject: Re: [ASN1] question about indefinite encoding in BER Banibrata Dutta wrote: > Hi, > > My question is about indefinite form of encoding in BER. > > I believe the TLV = (0x00 0x00) form a regular acceptable TLV, and can > also serve as a termination-indicator in case of indefinite encoding. > Consider the example:- > > ( T1 L1 (T2 L2 V2) (T3 L3 V3) (00 00) (00 00) ) (T4 L4 V4) > > ^ > ( T1 L1 (T2 L2 V2) (T3 L3 V3) (00 00) ) (00 00) (T4 L4 V4) > > ^ where L1 = 0x80. > > Which one of the above two cases is legal ? If neither L2 nor L3 have indefinite length form (and they both have definite form, judging from your way of putting braces around the TLV tuples), then the second case is legal. The indefinite form basically pushes the expectation of end-of-content octets to the decoding stack. Every time the next TLV at the T1 level is found, it is checked whether it is end-of-content sequence. The first end-of-content bytes at the T1 level will serve as a terminator for the T1 sequence. Please note that if T2 or T3 have indefinite length forms, they would "eat" the end-of-content octets closest to them: T1 iL1 ; indefinite form T2 iL2 ; indefinite form ... 00 00 ; terminates T2! T3 L3 ; definite form V3 00 00 ; terminates T1! -- Lev Walkin [EMAIL PROTECTED] _______________________________________________ ASN1 mailing list [email protected] http://lists.asn1.org/mailman/listinfo/asn1
