der解码规则_ASN.1探索 - 3编码规则与传输语法(CER与DER)(転)

长度域Length L

        primitive类型采用定长形式(有长、短两种情况);

        constructed类型采用不定长形式。

不管是primitive还是constructed类型,L都是定长形式的。

BOOLEAN

值“TRUE”的编码为:11111111。

REAL

        if the base component equals 10, a real value is encoded as a character string of NR3 format without spaces [ISO6093]; it has no “+" sign if the number is positive; the dot is the decimal separator; the mantissa must not begin nor end with zeros; it is followed by a dot and the E character; the exponent must not use the “+" sign nor begin with a 0 but for the null exponent denoted “+0"

        [X.509] forbids base-10-real values in the Directory applications

        if base = 2, a real value is binary-encoded with mantissa M and exponent E so that the mantissa equals 0 or is an odd number; the mantissa and the exponent are encoded on the minimum number of octets; the scale factor F equals 0

BIT STRING

最后一个八位组中未使用的比特为0;

如果包含一个命名列表,最后的0比特不编码;如果该类型有SIZE约束,则按照需要补充并且编码最后的0比特;如果取值为空,则长度为1,值为全0的八位组。

BIT STRING或者OCTET STRING或者CHARACTER STRING

如果小于1000个八位组,则采用primitive形式;

否则采用constructed形式;除最后一个外,其余子部分,每个为1000个八位组。

一律采用primitive形式。

GeneralString

escape sequences must only be used when the requested character set differs from the usual C0, C1 and G sets (see also the defect report http://www.furniss.co.uk/maint/asn/dr8825 1 005.htm)

GeneralizedTime或者UTCTime

秒不是必须的;秒片段中0有意义;如果没有秒片段,就没有小数点;

必须同步为Universal Time(即以z开头);

        GeneralizedTime类型,小数点必须使用。

SEQUENCE或者SET

各个成员等于其未编码的值。

SET

成员按照其Tag升序编码;如果模块声明包含AUTOMATIC TAGS,则按照描述的顺序编码;

当成员是一个无Tag的CHOICE,它要用其选项中最小Tag来参加排序(静态顺序)

当成员是一个无Tag的CHOICE,它要用被选择项的Tag来参加培训(动态顺序)

为了避免这种排序步骤,推荐用SEQUENCE替代SET。

SET OF

按照编码的升序排列:这些编码作为OCTET STRING进行比较,比较需要的话,后面补充空八位组;

为了避免这种动态的排序,推荐用SEQUENCE OF替代SET OF。

EXTERNAL、EMBEDDED PDV或者CHARACTER STRING

只有当抽象语法包含子类型约束避免传递表示上、下文标识的情况下,才能接力传递,如:

EMBEDDED PDV (WITH COMPONENTS {...,

identification (WITH COMPONENTS { ...,

presentation-context-id ABSENT,

context-negotiation ABSENT })})

和字符抽象语法相关联的字符传输语法注册在{iso standard 10646 level-1(1)}都是规范的;此外,符合注册为level-2(2)或者level-3(3)抽象语法的值也能接力传递。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值