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

Reply via email to