TL;博士
gpg -vvv --list-packets大概可以回答大部分问题。
这篇文章建立在 Jens Erat 的回答之上
gpg --list-packets可以使用详细程度和调试开关。请注意,虽然手册页只讨论了最多传递 2 个详细开关,但 gpg 确实响应了最多 3 个详细开关。
的--debug-level 1,开关是不是很有意思,--debug-all很有趣,但对上帝的爱做它一个空文件。我的加密空文件产生了 414 行输出,我的 1GB 文件产生了 270 万行。
我已经包含了 pgpdump 的输出示例,以及具有不同详细程度的 gpg。我不得不剪掉--debug-all,因为它占用了太多空间。
仅供参考,我正在运行 gpg (GnuPG) 2.2.27
pgpdump ./big_buck_bunny_1080p_surround.avi.gpg 2>&1 | head -n 15
Old: Public-Key Encrypted Session Key Packet(tag 1)(94 bytes)
New version(3)
Key ID - 0xD2E1F0CBF16B1266
Pub alg - Reserved for Elliptic Curve(pub 18)
unknown(pub 18)
-> m = sym alg(1 byte) + checksum(2 bytes) + PKCS-1 block type 02
New: Symmetrically Encrypted and MDC Packet(tag 18)(8192 bytes) partial start
Ver 1
Encrypted data [sym alg is specified in pub-key encrypted session key]
(plain text + MDC SHA1(20 bytes))
New: (8192 bytes) partial continue
New: (8192 bytes) partial continue
New: (8192 bytes) partial continue
New: (8192 bytes) partial continue
New: (8192 bytes) partial continue
$ gpg --list-packets ./big_buck_bunny_1080p_surround.avi.gpg
gpg: encrypted with 255-bit ECDH key, ID D2E1F0CBF16B1266, created 2021-03-23
"your dog (doggy) <dog@dog.dog>"
# off=0 ctb=84 tag=1 hlen=2 plen=94
:pubkey enc packet: version 3, algo 18, keyid D2E1F0CBF16B1266
data: [263 bits]
data: [392 bits]
# off=96 ctb=d2 tag=18 hlen=2 plen=0 partial new-ctb
:encrypted data packet:
length: unknown
mdc_method: 2
# off=117 ctb=a3 tag=8 hlen=1 plen=0 indeterminate
:compressed packet: algo=2
# off=119 ctb=ae tag=11 hlen=5 plen=928670793
:literal data packet:
mode b (62), created 1616485594, name="big_buck_bunny_1080p_surround.avi",
raw data: 928670754 bytes
$ gpg -vvv --list-packets ./big_buck_bunny_1080p_surround.avi.gpg
gpg: using character set 'utf-8'
# off=0 ctb=84 tag=1 hlen=2 plen=94
:pubkey enc packet: version 3, algo 18, keyid D2E1F0CBF16B1266
data: [263 bits]
data: [392 bits]
gpg: public key is D2E1F0CBF16B1266
gpg: using subkey D2E1F0CBF16B1266 instead of primary key CCD3793A53651BF6
gpg: public key encrypted data: good DEK
# off=96 ctb=d2 tag=18 hlen=2 plen=0 partial new-ctb
:encrypted data packet:
length: unknown
mdc_method: 2
gpg: using subkey D2E1F0CBF16B1266 instead of primary key CCD3793A53651BF6
gpg: encrypted with 255-bit ECDH key, ID D2E1F0CBF16B1266, created 2021-03-23
"your dog (doggy) <dog@dog.dog>"
gpg: AES256 encrypted data
# off=117 ctb=a3 tag=8 hlen=1 plen=0 indeterminate
:compressed packet: algo=2
# off=119 ctb=ae tag=11 hlen=5 plen=928670793
:literal data packet:
mode b (62), created 1616485594, name="big_buck_bunny_1080p_surround.avi",
raw data: 928670754 bytes
gpg: decryption okay