asn.1中的方括号

asn.1编码以tag + length + value为基本单元,IMPLICIT模式是用context-specific tag替换后面通常是universal的tag;EXPLICIT模式是用context-specific tag的tlv包裏里层的universal tag的tlv。

ber编码时,会默认为EXPLICIT模式。

在bnf范式语法中

1
2
3
4
5
圆括号(): 相当于C语言算术表达式中圆括号()的作用。
尖括号<>: 内包含的为必选项。 
方括号[]: 内包含的为可选项。 
花括号{}: 内包含的为可重复0至无数次的项。 
|: 或or的意思;若要表示并and的意思,直接两个符号之间空白间隔。

而在asn.1语法中,方括号[Index]指示的是context-specific tag值,即0xA0 + Index;花括号{}用于SEQUENCE,SET或CHOICE的定义。如

1
2
Number2 ::= [7] IMPLICIT [1] INTEGER
AccountedClosed ::= [2] EXPLICIT BOOLEAN

这里Number2的tag值为0xA7;而对于AccountedClosed,当其值为true时其ber编码为

1
0xA2 0x3 0x1 0x1 0xFF

refer to:
https://blog.csdn.net/sever2012/article/details/7767867
https://www.cnblogs.com/qook/p/5957436.html

数字证书备忘录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
ca: certification authority
pem: privacy enhanced mail, "begin"+base64+"end"
der: distinguished encoding rules, binary
crt: certificate
cer: certificate
csr: certificate signing request
pkcs: public key cryptography standard
ietf: internet engineering task force
pkcs#12/pfx/p12: file format encoding private keys, certificates and etc, rfc7292
pkcs#7: cryptographic message syntex standard
pkcs#10/p10: certification request syntax specification, rfc2986
x.509: public key certificates format standard
ber: basic encoding rules
per: packed encoding rules
crl: certificate revocation list
dsa: digital signature algorithm

refer to:
http://www.360doc.com/content/15/0520/10/21412_471902987.shtml
https://baike.baidu.com/item/BER/19940289?fr=aladdin
https://blog.csdn.net/mao834099514/article/details/109074661
https://datatracker.ietf.org/doc/html/rfc7292