简体   繁体   中英

Understanding ASN.1 Integer PER encoding

Consider this Wireshark trace for a h225 Ras Registration Request (RRQ):

在此输入图像描述

as you can see, Wireshark decodes requestSeqNum as 25601 but the byte presentation is 0x6400 which is 25600. I looked in the ASN.1 PER encoding rules, but I can't find the reason why the value would have to be increased with 1. My question, is wireshark decoding this correctly and if so, where can I find this in the spec?

ASN.1 code:

RequestSeqNum       ::= INTEGER (1..65535)

In fact, Wireshark consistently adds 1 to requestSeqNum for all h225 messages.

Never mind,

found it in the Spec :

11.5.7.3 (The two-octet case.) If the "range" has a value greater than or equal to 257 and less than or equal to 64K, then the value ("n" – "lb") shall be encoded in a two-octet bit-field (octet-aligned in the ALIGNED variant) as a non-negative- binary-integer encoding as specified in 11.3.

lb (Lower bound) is in this case 1 so that explains my question. I was looking at the wrong place in the spec, I get headaches from reading specifications :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM