On Wed, 11 Sep 2002, Pino Roberto wrote: > Thanks for the answers... > My second question was "How can I tell to the decoder that a structure must > be encoded with indefinite lenght and that another must be encoded with > definite lenght within the same input file? Is there any standard identifier > in the ASN.1 definition of the structure to use?". > My question was about the ASN1 syntax to say that a structure must be > encoded with indefinite lenght.
You don't tell the decoder that a value was encoded using the definite or indefinite length form. X.690 (BER) requires all decoders that conform to the BER standard to support both definite and indefinite length encodings. The BER decoder can determine which value is encoded using the definite or indefinite length form because the encodings are self-descriptive. A length of hex 80 says it is using the indefinite length form, and anything else says it is the definite length form. Bancroft > -----Messaggio originale----- > Da: Bancroft Scott [mailto:[EMAIL PROTECTED]] > Inviato: mercoled� 11 settembre 2002 14.33 > A: '[EMAIL PROTECTED]' > Oggetto: Re: [ASN.1] Abount definite and indefinite lenght encoding > > > On Wed, 11 Sep 2002, Pino Roberto wrote: > > > Hi, > > I would like to know if it's possible with ASN.1, use different lenght > > encodings for structure in the same file. > > For example, is possible encoding a structure with indefinite lenght > > encoding and another (may be a substructure of the first one) with > definite > > lenght encoding? > > Yes, with BER the encoder is free to choose either definite or indefinite > length encodings. Of course, if an application profile dictates that > only one or the other must be used, then you are obliged to use the > specified one. > > > And if it's possibile, how can the encoder recognize structures to be > > encoded with definite lenght encoding from structures with indefinite > > lenght encoding? Is there any ASN.1 tag to use? Thanks, bye, Roberto > > I take it that you meant to say "how can the decoder ...". Yes? > > If yes, it can tell whether definite or indefinite length encoding was > used based on whether the length field has a value of hex 80. > > If no, check with the provider of the tool that you are using. > > ------------------------------------------------------------------------- > Bancroft Scott Toll Free :1-888-OSS-ASN1 > OSS Nokalva International:1-732-302-0750 > [EMAIL PROTECTED] Tech Support :1-732-302-9669 > x-1 > 1-732-302-9669 x-200 Fax :1-732-302-0023 > http://www.oss.com >
