本文介绍了使用SecAsn1Decode解析DER格式的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 SecAsn1Decode
来解析以下DER编码的数据.
I'm trying to use SecAsn1Decode
in order to parse the following DER encoded data.
但是,我未能为此结构定义模板(由 SecAsn1Template
表示").
However, I failed to define the template for this struct (represented by SecAsn1Template
).
也许任何人都可以解释如何为以下DER结构创建模板:
perhaps anybody can explain how to create a template for the following DER structure :
这是二进制原始数据(DER格式)
here's the binary raw data (DER formatted)
30 81 8E 31 0B 30 09 06 03 55 04 06 13 02 49 4C
31 0F 30 0D 06 03 55 04 08 0C 06 69 73 72 61 65
6C 31 0C 30 0A 06 03 55 04 07 0C 03 54 4C 56 31
0B 30 09 06 03 55 04 0A 0C 02 54 53 31 1E 30 1C
06 03 55 04 0B 0C 15 43 41 5F 63 65 72 74 69 66
69 63 61 74 65 5F 73 65 72 76 65 72 31 1B 30 19
06 03 55 04 03 0C 12 61 61 61 61 61 61 61 4D 61
63 42 6F 6F 6B 5F 50 72 6F 31 16 30 14 06 09 2A
86 48 86 F7 0D 01 09 01 16 07 7A 40 7A 2E 63 6F
6D
这是使用asn1 java解码器对此数据的解释 https://lapo.it/asn1js
and here's the interpretation of this data using asn1 java decoderhttps://lapo.it/asn1js
EQUENCE (7 elem)
SET (1 elem)
SEQUENCE (2 elem)
OBJECT IDENTIFIER 2.5.4.6 countryName (X.520 DN component)
PrintableString aa
SET (1 elem)
SEQUENCE (2 elem)
OBJECT IDENTIFIER 2.5.4.8 stateOrProvinceName (X.520 DN component)
UTF8String aaaaaa
SET (1 elem)
SEQUENCE (2 elem)
OBJECT IDENTIFIER 2.5.4.7 localityName (X.520 DN component)
UTF8String aaa
SET (1 elem)
SEQUENCE (2 elem)
OBJECT IDENTIFIER 2.5.4.10 organizationName (X.520 DN component)
UTF8String TS
SET (1 elem)
SEQUENCE (2 elem)
OBJECT IDENTIFIER 2.5.4.11 organizationalUnitName (X.520 DN component)
UTF8String CA_certificate_server
SET (1 elem)
SEQUENCE (2 elem)
OBJECT IDENTIFIER 2.5.4.3 commonName (X.520 DN component)
UTF8String aaaaaaaaaaaaaaaaaa
SET (1 elem)
SEQUENCE (2 elem)
OBJECT IDENTIFIER 1.2.840.113549.1.9.1 emailAddress (PKCS #9. Deprecated, use an altName extension instead)
IA5String [email protected]
推荐答案
这是DER/BER TLV数据.
It is DER/BER TLV data.
以下是使用 https://iso8583.info/解析的详细数据lib/ISO/8825/1/BER/TLVs
TLVs:#"30818E310B300906035504061302494C310F300D06035504080C06697372..6F6D" # ASN.1, Basic Encoding Rules (BER), Tag + Length + Value (TLV) series
- x30:#"30818E310B300906035504061302494C310F300D06035504080C06697372..6F6D" # SEQUENCE
- tag: "30"
- len: "818E" # // 142
- val:#"310B300906035504061302494C310F300D06035504080C0669737261656C..6F6D"
- x31:#"310B300906035504061302494C" # SET
- tag: "31"
- len: "0B" # // 11
- val:#"300906035504061302494C"
- x30:#"300906035504061302494C" # SEQUENCE
- tag: "30"
- len: "09" # // 9
- val:#"06035504061302494C"
- x06:#"0603550406" # Object Identifier (OID)
- tag: "06"
- len: "03" # // 3
- val: "550406" # // 2 5 4 6 - joint-iso-itu-t.ds.attributeType.countryName
- x13:#"1302494C" # PrintableString
- tag: "13"
- len: "02" # // 2
- val: "494C" # // IL
- x31:#"310F300D06035504080C0669737261656C" # SET
- tag: "31"
- len: "0F" # // 15
- val:#"300D06035504080C0669737261656C"
- x30:#"300D06035504080C0669737261656C" # SEQUENCE
- tag: "30"
- len: "0D" # // 13
- val:#"06035504080C0669737261656C"
- x06:#"0603550408" # Object Identifier (OID)
- tag: "06"
- len: "03" # // 3
- val: "550408" # // 2 5 4 8
- x0C:#"0C0669737261656C" # UTF8String
- tag: "0C"
- len: "06" # // 6
- val: "69737261656C" # // israel
- x31:#"310C300A06035504070C03544C56" # SET
- tag: "31"
- len: "0C" # // 12
- val:#"300A06035504070C03544C56"
- x30:#"300A06035504070C03544C56" # SEQUENCE
- tag: "30"
- len: "0A" # // 10
- val:#"06035504070C03544C56"
- x06:#"0603550407" # Object Identifier (OID)
- tag: "06"
- len: "03" # // 3
- val: "550407" # // 2 5 4 7 - joint-iso-itu-t.ds.attributeType.localityName
- x0C:#"0C03544C56" # UTF8String
- tag: "0C"
- len: "03" # // 3
- val: "544C56" # // TLV
- x31:#"310B3009060355040A0C025453" # SET
- tag: "31"
- len: "0B" # // 11
- val:#"3009060355040A0C025453"
- x30:#"3009060355040A0C025453" # SEQUENCE
- tag: "30"
- len: "09" # // 9
- val:#"060355040A0C025453"
- x06:#"060355040A" # Object Identifier (OID)
- tag: "06"
- len: "03" # // 3
- val: "55040A" # // 2 5 4 10 - joint-iso-itu-t.ds.attributeType.organizationName
- x0C:#"0C025453" # UTF8String
- tag: "0C"
- len: "02" # // 2
- val: "5453" # // TS
- x31:#"311E301C060355040B0C1543415F63657274696669636174655F736572766572" # SET
- tag: "31"
- len: "1E" # // 30
- val:#"301C060355040B0C1543415F63657274696669636174655F736572766572"
- x30:#"301C060355040B0C1543415F63657274696669636174655F736572766572" # SEQUENCE
- tag: "30"
- len: "1C" # // 28
- val:#"060355040B0C1543415F63657274696669636174655F736572766572"
- x06:#"060355040B" # Object Identifier (OID)
- tag: "06"
- len: "03" # // 3
- val: "55040B" # // 2 5 4 11 - joint-iso-itu-t.ds.attributeType.organizationUnitName
- x0C:#"0C1543415F63657274696669636174655F736572766572" # UTF8String
- tag: "0C"
- len: "15" # // 21
- val: "43415F63657274696669636174655F736572766572" # // CA_certificate_server
- x31:#"311B301906035504030C12616161616161614D6163426F6F6B5F50726F" # SET
- tag: "31"
- len: "1B" # // 27
- val:#"301906035504030C12616161616161614D6163426F6F6B5F50726F"
- x30:#"301906035504030C12616161616161614D6163426F6F6B5F50726F" # SEQUENCE
- tag: "30"
- len: "19" # // 25
- val:#"06035504030C12616161616161614D6163426F6F6B5F50726F"
- x06:#"0603550403" # Object Identifier (OID)
- tag: "06"
- len: "03" # // 3
- val: "550403" # // 2 5 4 3 - joint-iso-itu-t.ds.attributeType.commonName
- x0C:#"0C12616161616161614D6163426F6F6B5F50726F" # UTF8String
- tag: "0C"
- len: "12" # // 18
- val: "616161616161614D6163426F6F6B5F50726F" # // aaaaaaaMacBook_Pro
- x31:#"3116301406092A864886F70D01090116077A407A2E636F6D" # SET
- tag: "31"
- len: "16" # // 22
- val:#"301406092A864886F70D01090116077A407A2E636F6D"
- x30:#"301406092A864886F70D01090116077A407A2E636F6D" # SEQUENCE
- tag: "30"
- len: "14" # // 20
- val:#"06092A864886F70D01090116077A407A2E636F6D"
- x06:#"06092A864886F70D010901" # Object Identifier (OID)
- tag: "06"
- len: "09" # // 9
- val: "2A864886F70D010901" # // 1 2 840 113549 1 9 1 - iso.member-body.us.rsadsi.pkcs.pkcs-9.emailAddress
- x16:#"16077A407A2E636F6D" # IA5String
- tag: "16"
- len: "07" # // 7
- val: "7A407A2E636F6D" # // [email protected]
这篇关于使用SecAsn1Decode解析DER格式的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!