Hello everybody,

I have a structure that contains a list which is defined as a "SEQUENCE OF"
data type. I need to encode this structure in Octet Encoding Rules (OER).
The OER standard says that the Id and the Length fields do not need to be
encoded. The Content field has two sub-fields: the length of the list
followed by the encoding of each object in the list, in their corresponding
order.
For the first sub-field (the length of the list), the OER standard asks to
be encoded as an unconstrained non-negative integer, according to rules
10.3.2 - 10.3.5 in the ISO/IEC 8825-2 standard. This is the standard for PER
and those rules describe how a non-negative binary integer should be
encoded. Since there is no restriction on the length of the list, I guess
that the minimum encoding should be used, that is, I need to encode a
minimum number of octets, enough to represent the number (and this is clause
10.3.6). However, the standard doesn't go any further to describe how this
encoding must be done. Reading Mr. Dubuisson's free book on ASN.1 I found
some references on how this encoding should be done.
So,
  - if the unconstrained non-negative integer < 0x80, the encoding should
take 1 byte and would have to be 0XXX XXXX;
  - if the unconstrained non-negative integer < 0x4000, the encoding should
take 2 bytes and would have to be 10XX XXXX XXXX XXXX;
  - if the unconstrained non-negative integer >= 0x4000, the encoding should
take 3 or more bytes, where the first byte would have to be 11XX XXXX and it
would be followed by a combination of 0X, 10 or 11 bytes;

This algorithm was included in a paragraph dedicated to encoding of a length
field.

Is this correct?

Any help would be greatly appreciated.

Thanks,
Eddie


_______________________________________________
ASN1 mailing list
[email protected]
http://lists.asn1.org/mailman/listinfo/asn1

Reply via email to