- labels: --> Library
- milestone: --> v1.5
- assigned_to: nobody --> akira_ag
I've encountered such problem. When we have a structure SEQUENCE OF and its length is 128 Decoder can not decode properly.
I've found this in documentation on BER format.
There are two ways of encoding lengths - the definite form, and the indefinite form.
For the definite form, if the length is less than 128, you just use a single byte, with the high bit set to zero. Otherwise the high bit is set to one, and the low seven bits set to the length of length. The length is then encoded in that many bytes.
The indefinite form is encoded by sending a length field with a length of length of 0 - i.e. [1000|0000]. The object is ended by sending two zero bytes.
So if we have The indefinite form we don't know element's length, we should calculate it by finding a final two zero bytes.