ASN.1 如何编码对象标识符? [英] How does ASN.1 encode an object identifier?

查看:41
本文介绍了ASN.1 如何编码对象标识符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法理解 ASN.1 的基本概念.

I am having trouble understanding the basic concepts of ASN.1.

如果一个类型是一个 OID,那么对应的数字是否真的被编码到了二进制数据中?

If a type is an OID, does the corresponding number get actually encoded in the binary data?

例如在这个定义中:

id-ad-ocsp         OBJECT IDENTIFIER ::= { id-ad 1 }

相应的 1.3.6.1.5.5.7.48.1 是否完全像这样在二进制中编码?

Does the corresponding 1.3.6.1.5.5.7.48.1 get encoded in the binary exactly like this?

我问这个是因为我想了解我在 DER 文件(证书)中看到的特定值,即 04020500,但我不知道如何解释它.

I am asking this because I am trying to understand a specific value I see in a DER file (a certificate), which is 04020500, and I am not sure how to interpret it.

推荐答案

是的,OID 是在二进制数据中编码的.你提到的 OID 1.3.6.1.5.5.7.48.1 变成了 2b 06 01 05 05 07 30 01(前两个数字被编码在一个字节中,所有剩余的数字也被编码在一个字节中,因为它们都是小于 128).

Yes, the OID is encoded in the binary data. The OID 1.3.6.1.5.5.7.48.1 you mention becomes 2b 06 01 05 05 07 30 01 (the first two numbers are encoded in a single byte, all remaining numbers are encoded in a single bytes as well because they're all smaller than 128).

找到了一个很好的 OID 编码描述 这里.

A nice description of OID encoding is found here.

但分析 ASN.1 数据的最佳方法是粘贴到在线解码器中,例如http://lapo.it/asn1js/.

But the best way to analyze your ASN.1 data is to paste in into an online decoder, e.g. http://lapo.it/asn1js/.

这篇关于ASN.1 如何编码对象标识符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆