First of all you have to make sure that the first tag octet indicates a primitive encoding form or a constructed encoding form. In the first case the length is encoded in definite form and in the second case you may choose to code the length in definite or indefinite form. I assume that you are willing to code the length in definite form and because the length of your V is '302' octets you have to choose the long definite length form. Therefore you have to encode your length this way:
10000010 00000001 00101110
and you can figure out how to code it in HEX.
The pattern for encoding lengths using the long definite length form is
1zzzzzzz ******** ... ********
where
zzzzzzz = number of octets needed for encoding L (with your example 2 octets are needed to encode '302')
******** ... ******** = binary encoding of L (binary encoding of '302' = 00000001 00101110)
I suggest you take a look at chapter 18 of Olivier Dubuisson's book which is freely available (after registration) on www.oss.com. It will undoubtly answer these questions.
BTW:
I am looking for TAP3 decoders and their implementations, so if
anybody has available source code and is willing to grant me permission
to read it, I will gladly accept it :-) and please don't tell me to have
a look at some commercially available decoder :-(
Sergio da Silva
"Salai Sivamal.G" wrote:
Hi all,I have a doubt regarding Length octets in BER.
My question is, How to specify length octets, if it's value is greater than
'255'.
Because we cannot specify it in a single octet.For Example,
I want to specify a Length value as '302'.
Can i specify it in two octets, in this case value will be 01 2E.T = some value
L = 01 2E
V = some valuewhile interpreting, the boundry between L and V is not very clear.
My mistaken, there is a chance to read only '01' as length and 2E as value.how to avoid this ?
It would be really helpful for me if somebady tells the answer.
Thanks in advance.
-Salai.g
www.icope.com
