JavaScript generic ASN.1 parser (mirror)
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

There's no way to know if CHOICE id is "more interesting" than existing one, so I guess the best way is to show both.

Closes GitHub issue #102.

+35 -18
+15 -1
.vscode/launch.json
··· 42 42 { 43 43 "type": "node", 44 44 "request": "launch", 45 - "name": "dumpASN1 cert", 45 + "name": "dumpASN1 X.509", 46 + "skipFiles": [ 47 + "<node_internals>/**" 48 + ], 49 + "program": "${workspaceFolder}/dumpASN1.js", 50 + "args": [ 51 + "examples/ed25519.cer", 52 + "1.3.6.1.5.5.7.0.18", 53 + "Certificate" 54 + ] 55 + }, 56 + { 57 + "type": "node", 58 + "request": "launch", 59 + "name": "dumpASN1 CRL", 46 60 "skipFiles": [ 47 61 "<node_internals>/**" 48 62 ],
+4 -2
defs.js
··· 35 35 c = translate(c); 36 36 if (tn == c.type.name || tn == c.name) { 37 37 def = Object.assign({}, def); 38 - if (c.id) def.id = c.id; 38 + if (c.id) // show the CHOICE id, but add it to existing one if present 39 + def.id = def.id ? def.id + ' ' + c.id : c.id; 39 40 def.type = c.type.name ? c.type : c; 40 41 break; 41 42 } ··· 95 96 type = def.content[j++]; 96 97 if (!type || typeof type != 'object') break; 97 98 if (type?.type?.type) 98 - type = type.type; 99 + // type = type.type; 100 + type = Object.assign({}, type.type, {id: type.id}); 99 101 if (type.type == 'defined') { 100 102 let t2 = translate(type, tn); 101 103 if (t2.type.name == tn) break; // exact match
+4 -4
examples/crl-rfc5280.b64.dump
··· 4 4 signature AlgorithmIdentifier SEQUENCE @10+13 (constructed): (2 elem) 5 5 algorithm OBJECT_IDENTIFIER @12+9: 1.2.840.113549.1.1.5|sha1WithRSAEncryption|PKCS #1 6 6 parameters ANY NULL @23+0 7 - issuer Name SEQUENCE @25+67 (constructed): (3 elem) 7 + issuer rdnSequence Name SEQUENCE @25+67 (constructed): (3 elem) 8 8 RelativeDistinguishedName SET @27+19 (constructed): (1 elem) 9 9 AttributeTypeAndValue SEQUENCE @29+17 (constructed): (2 elem) 10 10 type AttributeType OBJECT_IDENTIFIER @31+10: 0.9.2342.19200300.100.1.25|domainComponent|Men are from Mars, this OID is from Pluto ··· 17 17 AttributeTypeAndValue SEQUENCE @75+17 (constructed): (2 elem) 18 18 type AttributeType OBJECT_IDENTIFIER @77+3: 2.5.4.3|commonName|X.520 DN component 19 19 value AttributeValue [?] PrintableString @82+10: Example CA 20 - utcTime Time UTCTime @94+13: 2005-02-05 12:00:00 UTC 21 - utcTime Time UTCTime @109+13: 2005-02-06 12:00:00 UTC 20 + thisUpdate utcTime Time UTCTime @94+13: 2005-02-05 12:00:00 UTC 21 + nextUpdate utcTime Time UTCTime @109+13: 2005-02-06 12:00:00 UTC 22 22 revokedCertificates SEQUENCE @124+34 (constructed): (1 elem) 23 23 SEQUENCE @126+32 (constructed): (3 elem) 24 24 userCertificate CertificateSerialNumber INTEGER @128+1: 18 25 - utcTime Time UTCTime @131+13: 2004-11-19 15:57:03 UTC 25 + revocationDate utcTime Time UTCTime @131+13: 2004-11-19 15:57:03 UTC 26 26 crlEntryExtensions Extensions SEQUENCE @146+12 (constructed): (1 elem) 27 27 Extension SEQUENCE @148+10 (constructed): (2 elem) 28 28 extnID OBJECT_IDENTIFIER @150+3: 2.5.29.21|cRLReason|X.509 extension
+4 -4
examples/ed25519.cer.dump
··· 5 5 serialNumber CertificateSerialNumber INTEGER @13+20: (159 bit)|711090297755414526861352146244170174161660335942 6 6 signature AlgorithmIdentifier SEQUENCE @35+5 (constructed): (1 elem) 7 7 algorithm OBJECT_IDENTIFIER @37+3: 1.3.101.112|curveEd25519|EdDSA 25519 signature algorithm 8 - issuer Name SEQUENCE @42+53 (constructed): (3 elem) 8 + issuer rdnSequence Name SEQUENCE @42+53 (constructed): (3 elem) 9 9 RelativeDistinguishedName SET @44+11 (constructed): (1 elem) 10 10 AttributeTypeAndValue SEQUENCE @46+9 (constructed): (2 elem) 11 11 type AttributeType OBJECT_IDENTIFIER @48+3: 2.5.4.6|countryName|X.520 DN component ··· 19 19 type AttributeType OBJECT_IDENTIFIER @78+3: 2.5.4.3|commonName|X.520 DN component 20 20 value AttributeValue [?] UTF8String @83+12: Test ed25519 21 21 validity Validity SEQUENCE @97+30 (constructed): (2 elem) 22 - utcTime Time UTCTime @99+13: 2020-09-02 13:25:26 UTC 23 - utcTime Time UTCTime @114+13: 2030-09-02 13:25:26 UTC 24 - subject Name SEQUENCE @129+53 (constructed): (3 elem) 22 + notBefore utcTime Time UTCTime @99+13: 2020-09-02 13:25:26 UTC 23 + notAfter utcTime Time UTCTime @114+13: 2030-09-02 13:25:26 UTC 24 + subject rdnSequence Name SEQUENCE @129+53 (constructed): (3 elem) 25 25 RelativeDistinguishedName SET @131+11 (constructed): (1 elem) 26 26 AttributeTypeAndValue SEQUENCE @133+9 (constructed): (2 elem) 27 27 type AttributeType OBJECT_IDENTIFIER @135+3: 2.5.4.6|countryName|X.520 DN component
+1 -1
examples/ldapmessage.b64.dump
··· 1 1 LDAPMessage SEQUENCE @0+53 (constructed): (3 elem) 2 2 messageID MessageID INTEGER @2+1: 5 3 - delRequest CHOICE Application_10 @5+17: (17 byte)|dc=example,dc=com 3 + protocolOp delRequest CHOICE Application_10 @5+17: (17 byte)|dc=example,dc=com 4 4 Controls [?] [0] @24+29 (constructed): (1 elem) 5 5 AttributeTypeAndValue SEQUENCE @26+27 (constructed): (2 elem) 6 6 type AttributeType [?] OCTET_STRING @28+22: (22 byte)|1.2.840.113556.1.4.805
+6 -6
examples/sig-p256-der.p7m.dump
··· 19 19 serialNumber CertificateSerialNumber INTEGER @10117+16: (127 bit)|128087855099855233032551836648087377254 20 20 signature AlgorithmIdentifier SEQUENCE @10135+10 (constructed): (1 elem) 21 21 algorithm OBJECT_IDENTIFIER @10137+8: 1.2.840.10045.4.3.2|ecdsaWithSHA256|ANSI X9.62 ECDSA algorithm with SHA256 22 - issuer Name SEQUENCE @10147+15 (constructed): (1 elem) 22 + issuer rdnSequence Name SEQUENCE @10147+15 (constructed): (1 elem) 23 23 RelativeDistinguishedName SET @10149+13 (constructed): (1 elem) 24 24 AttributeTypeAndValue SEQUENCE @10151+11 (constructed): (2 elem) 25 25 type AttributeType OBJECT_IDENTIFIER @10153+3: 2.5.4.3|commonName|X.520 DN component 26 26 value AttributeValue [?] UTF8String @10158+4: Test 27 27 validity Validity SEQUENCE @10164+30 (constructed): (2 elem) 28 - utcTime Time UTCTime @10166+13: 2018-07-16 14:56:35 UTC 29 - utcTime Time UTCTime @10181+13: 2019-07-16 14:56:35 UTC 30 - subject Name SEQUENCE @10196+15 (constructed): (1 elem) 28 + notBefore utcTime Time UTCTime @10166+13: 2018-07-16 14:56:35 UTC 29 + notAfter utcTime Time UTCTime @10181+13: 2019-07-16 14:56:35 UTC 30 + subject rdnSequence Name SEQUENCE @10196+15 (constructed): (1 elem) 31 31 RelativeDistinguishedName SET @10198+13 (constructed): (1 elem) 32 32 AttributeTypeAndValue SEQUENCE @10200+11 (constructed): (2 elem) 33 33 type AttributeType OBJECT_IDENTIFIER @10202+3: 2.5.4.3|commonName|X.520 DN component ··· 62 62 signerInfos SignerInfos SET @10474+394 (constructed): (1 elem) 63 63 SignerInfo SEQUENCE @10478+390 (constructed): (6 elem) 64 64 version CMSVersion INTEGER @10482+1: 1 65 - issuerAndSerialNumber SignerIdentifier SEQUENCE @10485+35 (constructed): (2 elem) 66 - rdnSequence Name SEQUENCE @10487+15 (constructed): (1 elem) 65 + sid issuerAndSerialNumber SignerIdentifier SEQUENCE @10485+35 (constructed): (2 elem) 66 + issuer rdnSequence Name SEQUENCE @10487+15 (constructed): (1 elem) 67 67 RelativeDistinguishedName SET @10489+13 (constructed): (1 elem) 68 68 AttributeTypeAndValue SEQUENCE @10491+11 (constructed): (2 elem) 69 69 type AttributeType OBJECT_IDENTIFIER @10493+3: 2.5.4.3|commonName|X.520 DN component
+1
package.json
··· 45 45 "engines": { 46 46 "node": ">=14.6.0" 47 47 }, 48 + "packageManager": "pnpm@7.33.7", 48 49 "devDependencies": { 49 50 "@eslint/eslintrc": "^3.3.1", 50 51 "@eslint/js": "^9.32.0",