Octet string 解析

本文介绍了ASN.1中的Octet String结构,包括如何解析字节流来确定内容长度。当字节数小于128时,长度字段只需1字节;超过127字节,第7位设为1,其余位表示额外的长度字节数。通过实例展示了字节的含义,并提供了解析代码示例。同时提到了位串的编码方式。
摘要由CSDN通过智能技术生成

百度百科的 ASN.1 http://baike.baidu.com/view/26378.htm

什么是 octet string 结构化字节

怎么解析,这里有微软的解析方法

If the byte array contains fewer than 128 bytes, the Length field of the TLV triplet requires only one byte to specify the content length. If it is more than 127 bytes, bit 7 of the Length field is set to 1 and bits 6 through 0 specify the number of additional bytes used to identify the content length. This is shown in the following example where the high order bit of the second byte on the first line is set to 1 and the byte indicates that there is a trailing Length byte. The third byte therefore specifies that the content is 0x80 bytes long.

以上就是解析,字节是代表什么意思

例如

字符串字节数小于128的时候:

04 0a                              ; OCTET_STRING (a Bytes)
|     1e 08 00 55 00 73 00 65  00 72  ;   ...U.s.e.r

解析

04 代表 OCTET_STRING 这个结构(参看基本类型汇总表)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值