[comp.protocols.iso] An ASN.1 question

auerbach@CSL.SRI.COM (Karl Auerbach) (06/05/89)

Hi --  My original posting of this seems to have gone astray (it will
certainly pop-up seconds after I do this reposting.  Such are the 
whims of the network gods.)

Last night I was playing about with my ASN.1 tools (my own, not
those in ISODE) and I tried something with surprising results.

What I did was this: I added an encoding strategy flag, much like
PS_LEN_INDF in ISODE which (in my code) is supposed to mean "whenever
legally possible use indefinite length encoding."

What happened, and what I am not sure is legal, is that everything
that has an explicit tag got an indefinite length encoding.  For
example, [12] INTEGER with a value of 127 came out encoded as:

[12] LENGTH  INTEGER  LENGTH  CONTENTS  END-OF-CONTENTS
AC   80      02       01      7F        00 00

I find ISO 8825 to be a bit ambiguous on this point:

Section 6.3.2 (b) and (c) seem to say that anything that is constructued
can be done with indefinite length.

But section 18.2 (regarding non-implicit tags) says that the "contents
octets shall be the complete base encoding."  (A very restrictive reading
of that could mean "the complete base encoding and nothing more -- such
as end-of-contents".)

Anyway, I'd sure like to hear whether the form I generated is legal.

					--karl--

tebbutt@RHINO.NCSL.NIST.GOV (John Tebbutt) (06/06/89)

Karl,

I believe that your encoding is legal. In ISO 8825, section 18.2 states that the
encoding of a non-implicit tagged type shall be constructed. The contents octets
should hold the proper encoding of the type from which the tagged type was 
derived (in your example, Integer).

Section 6.3.2 b states that you may use the definite or indefinite length
encoding at your option, if the encoding is constructed.

Since the tagged type in your example was not IMPLICIT, the encoding must be
constructed. And since the encoding must be constructed, you have the option
whether to use the definite or indefinite length encoding FOR THE TAGGED TYPE.
The encoding of the Integer within the contents octets of the tagged type must
be primitive, of course, and so the related length field needs to be of the
definite variety.

Good Luck !

						John Tebbutt
						National Institute of Standards
							and Technology

collin@hpindda.HP.COM (Collin Park) (06/13/89)

Yes, it's legal.  What 18.2 says about the contents octets does not
refer to the end-of-contents octets; 6.3.4.2 says that the EOC octets
come AFTER the contents octets.  I take this to mean 18.2's "contents
octets" shall be followed by EOC octets.

(p.s. my copy of 8825 is about 2 years old so my references may not be
100% correct)
------------------------------------------------------------------------------
Unless explicitly stated otherwise, opinions expressed above are my
own and do not explicitly reflect those of the Hewlett-Packard Company
or any other person or entity.

collin park			Hewlett-Packard Company
collin%hpda@hplabs.hp.com	19420 Homestead Road -- MS 43LT
				Cupertino, CA  95014  USA