1
1
mirror of https://github.com/wader/fq.git synced 2024-12-24 13:52:02 +03:00
fq/format/asn1/testdata/test.pem.fqtest
Mattias Wadman 8d69f1fb23 interp: Change default bits_format=string
I think this is more intuitive but might in some case cause very large JSON output
but maybe that less common or expected. In does cases i think you either want to
use some other bits_format (md5, truncate, etc) or you delete/transform the jq value
before turn it into JSON.

Strings in gojq are binary safe so you can use to hold raw bytes. But note that
convert the binary into JSON is lossy, same as the JSON standard.

Add bits_format option documentation.
2022-12-01 17:49:34 +01:00

57 lines
5.0 KiB
Plaintext

$ fq -d bytes 'frompem | asn1_ber | dv, torepr' test.pem
|00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f|0123456789abcdef|.{}: (asn1_ber) 0x0-0xa1.7 (162)
0x00|30 |0 | class: "universal" (0) 0x0-0x0.1 (0.2)
0x00|30 |0 | form: "constructed" (1) 0x0.2-0x0.2 (0.1)
0x00|30 |0 | tag: "sequence" (0x10) 0x0.3-0x0.7 (0.5)
0x00| 81 9f | .. | length: 159 0x1-0x2.7 (2)
| | | constructed[0:2]: 0x3-0xa1.7 (159)
| | | [0]{}: object 0x3-0x11.7 (15)
0x00| 30 | 0 | class: "universal" (0) 0x3-0x3.1 (0.2)
0x00| 30 | 0 | form: "constructed" (1) 0x3.2-0x3.2 (0.1)
0x00| 30 | 0 | tag: "sequence" (0x10) 0x3.3-0x3.7 (0.5)
0x00| 0d | . | length: 13 0x4-0x4.7 (1)
| | | constructed[0:2]: 0x5-0x11.7 (13)
| | | [0]{}: object 0x5-0xf.7 (11)
0x00| 06 | . | class: "universal" (0) 0x5-0x5.1 (0.2)
0x00| 06 | . | form: "primitive" (0) 0x5.2-0x5.2 (0.1)
0x00| 06 | . | tag: "object_identifier" (0x6) 0x5.3-0x5.7 (0.5)
0x00| 09 | . | length: 9 0x6-0x6.7 (1)
| | | value[0:7]: 0x7-0xf.7 (9)
0x00| 2a | * | [0]: 1 oid 0x7-0x7.7 (1)
0x00| 2a | * | [1]: 2 oid 0x7-0x7.7 (1)
0x00| 86 48 | .H | [2]: 840 oid 0x8-0x9.7 (2)
0x00| 86 f7 0d | ... | [3]: 113549 oid 0xa-0xc.7 (3)
0x00| 01 | . | [4]: 1 oid 0xd-0xd.7 (1)
0x00| 01 | . | [5]: 1 oid 0xe-0xe.7 (1)
0x00| 01| .| [6]: 1 oid 0xf-0xf.7 (1)
| | | [1]{}: object 0x10-0x11.7 (2)
0x10|05 |. | class: "universal" (0) 0x10-0x10.1 (0.2)
0x10|05 |. | form: "primitive" (0) 0x10.2-0x10.2 (0.1)
0x10|05 |. | tag: "null" (0x5) 0x10.3-0x10.7 (0.5)
0x10| 00 | . | length: "indefinite" (0) 0x11-0x11.7 (1)
| | | value: null 0x12-NA (0)
| | | [1]{}: object 0x12-0xa1.7 (144)
0x10| 03 | . | class: "universal" (0) 0x12-0x12.1 (0.2)
0x10| 03 | . | form: "primitive" (0) 0x12.2-0x12.2 (0.1)
0x10| 03 | . | tag: "bit_string" (0x3) 0x12.3-0x12.7 (0.5)
0x10| 81 8d | .. | length: 141 0x13-0x14.7 (2)
0x10| 00 | . | unused_bits_count: 0 0x15-0x15.7 (1)
0x10| 30 81 89 02 81 81 00 cc 61 f9| 0.......a.| value: raw bits 0x16-0xa1.7 (140)
0x20|ef 5a d0 bc 21 de 5b 3c a6 9e e7 25 d2 c5 04 ed|.Z..!.[<...%....|
* |until 0xa1.7 (end) (140) | |
[
[
[
1,
2,
840,
113549,
1,
1,
1
],
null
],
"0\ufffd\ufffd\u0002\ufffd\ufffd\u0000\ufffda\ufffd\ufffdZм!\ufffd[<\ufffd\ufffd\ufffd%\ufffd\ufffd\u0004\ufffd\ufffd\ufffdn\ufffd\ufffd'\ufffd\ufffd\ufffd#d\ufffd!\ufffd\ufffd\ufffdpER\ufffdѣ޲\ufffd\u001a\u000b\ufffdU\ufffd<\ufffd\ufffd\ufffd\u001a\ufffd\u00149+m\ufffd#F\ufffd|\ufffd\ufffdu\ufffd\ufffd+\ufffd'\ufffd\ufffd\u001f\\\ufffd\ufffd4\ufffd\u0011\u000e\ufffd\ufffdr\ufffd\ufffds\ufffd\ufffd8\ufffd\ufffd\ufffd\ufffd9\ufffd\ufffd\ufffd\ufffd4\u0011\ufffd\ufffd±\ufffd\ufffd\ufffd\ufffdQ;\u0005e\b\ufffd\b\ufffdCɛ\f\ufffd\",\ufffd\ufffd\ufffd\u0002\u0003\u0001\u0000\u0001"
]