Hi!
> I would like to know if it's possible with ASN.1, use different lenght
> encodings for structure in the same file.
Yes it is possible.
> 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?
No. An indefinite encoding uses '10000000b' as length. Normally, you
would encode in the 7 lower bits how many octets will follow
representing the length; with "0" octets the ASN.1-parser expects two
0x00-octets at the end of the stream; so an encoding may be:
T Li
0x30 0x80
T Ld
0x04 0x03 -- OCTET STRING "Hi!"
0x48 0x69 0x21
0x00 0x00 -- End Of Content
T = tag
Li = indefinite length
Ld = definite length
You would send: "0x30 0x80 0x04 0x03 0x48 0x69 0x21 0x00 0x00"
But beware: it depends on the encoding rules, whether you're allowed to
use it or not.
cu,
Bj�rn
--
Bj�rn Schneider
Fraunhofer Institute for Secure Telecooperation
Rheinstr. 75,
D-64295 Darmstadt, Germany
Tel.: +49-6151-869-5482
Fax: +49-6151-869-224
Email: [EMAIL PROTECTED]
URL: http://www.sit.fraunhofer.de