Article View: comp.protocols.iso
Article #1306Re: Question on ASN.1 Encodings
From: Art Berggreen
Date: Sat, 21 Nov 1992 00:54
Date: Sat, 21 Nov 1992 00:54
33 lines
1717 bytes
1717 bytes
In article <1drej9INN8t8@svcase.sp.paramax.com> scase@email.sp.paramax.com (Steve Case) writes: >I am trying to understand the various ASN.1 encoding and I cannot seem >to understand how the indefinite form for the length octets can possibly >work! To make things simple, let me give you a specific example and >hopefully someone can clarify the situation for me. > >Let's assume we are encoding a bitstring value. The particular bitstring >to be encoded is '0900000009'H. If I use the indefinite length format, >wouldn't this be encoded as follows: > > BitString Length Contents > 23 80 000900000009 > > EOC Length > 00 00 > > >My question, then, is when decoding this octet stream, how do you know >that the bitstring is '0900000009'H and not '09'H or '090'H or '0900'H >or '09000'H? All three of these seem to be possible decodings? Indefinite encodings are only legal on constructed types. Primitive types must always use definite length encoding. Thus you can always find the EOC encoding which terminates the innermost indefinite length encoding that it terminates. These things can be nested!!! >Thank you for any assistance you might be able to give me. > >Regards, >Steve Case >scase@planet8.sp.paramax.com Art
Technical Details
Message-ID:
<1992Nov21.005429.18843@acc.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!usc!news.service.uci.edu!network.ucsd.edu!ucsbcsl!spectrum.CMC.COM!fennel.acc.com!artReferences:
<1drej9INN8t8@svcase.sp.paramax.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!usc!news.service.uci.edu!network.ucsd.edu!ucsbcsl!spectrum.CMC.COM!fennel.acc.com!art From: art@acc.com (Art Berggreen) Newsgroups: comp.protocols.iso Subject: Re: Question on ASN.1 Encodings Message-ID: <1992Nov21.005429.18843@acc.com> Date: 21 Nov 92 00:54:29 GMT References: <1drej9INN8t8@svcase.sp.paramax.com> Organization: ACC, Advanced Computer Communications Lines: 33