"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'.
The same way as if they are greater than 127!!! > Because we cannot specify it in a single octet. 255 can not be encoded using a single octet either. The rules are defined in X.690. Shortly: Definite length: length < 128: single octet. (Short form) length >= 128: multiple octets (Long form) If first octet has MSB set to 1, it signals multiple octet encoding. The remaining 7 bits are used to give the number of successive octets used to encode the length. 127 is encoded as: 0x7F 128 is encoded as: 0x81 0x80 255 is encoded as: 0x81 0xFF 302 is encoded as: 0x82 0x01 0x2E Indefinite length: Length is encoded as: 0x80 Terminated after the constructed contents by 0x00 0x00 Please consult the freely available standards or one of the books on ASN.1/BER, and you will gain a lot of time. Best regards Egon Andersen -- * Talura ApS * Phone: +45 43 52 50 00 * * Baldersh�j 24 B * mailto:[EMAIL PROTECTED] * * DK-2635 Ish�j * http://www.talura.dk *
