Closed maxtaco closed 10 years ago
I think we need to find a more robust way to verify signatures, perhaps using gpg --list-packets
This solution was implemented in branch alt_verify_algo
. The issue is that it's broken. For instance, on input such as:
-----BEGIN PGP MESSAGE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
Comment: GPGTools - https://gpgtools.org
owG1lGuIVGUYx2c1b2u1unZb2CROYimjvPfLdJEoUoLCpFxUcnqvOyd3Z8aZM2vr
sh8KLILFVIgi/ZAfWorMvkSlZbIoZeZ2IaKi6AIV5AXSiIg0e99xvSz6JaiB4Zzz
nuc8/+f5PZdNV0zMtbYc6rh79jWjyw60fHhY55Yd/Pn7gURXbH9SGEjWuObFp+Vu
V6vW0nKWFBKnALNSYAGpU1IghhyFTHtjoCQMOsiMpciIJJ+UKvX4RXCjVd0tTCvh
LDwUUxtOL2HfaL7ggiJBJHJcIwUZlVZDraA3HCuGAYiGdVcrq14XrHWtsq5cUlky
mE+ymjJrYsRBLjX1eJfaYp+r1dNKOSlQkk96VD0L+kVTUiGp8D0CkCwAcAFgD0Bc
wCRYLQQArByvkilTgVGiGaED0kqogbeEam4Vsw5bygXWnFvUjHAMXcx2PD6DFXQO
AmIwVRQKzRiQFCCKgTAIO8ksBly76KMpBiCAQhmgvZcAKgAtNEgLQnCgxzmykJjA
igioMKDWAqMcDFkhpTFBnDKMMFAx9prrrWSuWK1VKj7AWTWQmCyN6UEsgp0IJPKJ
adRqQVVSxxTwjjnHnQ/liOitDJEBYgnC1ghojUJSCK2l0AZBzSARyDPOMYEhfDfm
nBKKyBnnYxFEKs0oIiJTcmZN0apMFR+pxzINJGehr0uzzNUurkRfpRwvMaemm2LW
Xw3vUD6pZyqLmuFN3a0tV5KCCHdp91jLKS+lJdIr6RSGkiIW6GlFOXWaeSSwCxbA
GA09Uh4yAA11lpJwagUiwCdnvI3pDeYvRCi44IiLcwidssSpUDpCmKfKagM81B4b
TpRhWisW5L3FAlhPkPHcQCqI0sgjKAQz4xAyws44/3cIu9Os1NAXE6z2NOrxPx7h
SGdSwJeCCPEFFJUTjHHtuUQM0NAJiAdyVFIhQvMZDiT2ROFQc+doHBNNvIGIhj4g
kkp0EcWHmjrFTKU9MfSq6u+pKFssqXrpv8H4P2UxGFdOM4exzZNPzu2aCO98a0iA
JBA0FPTRalpzxTRaUB5GLvxiBVxfnHQGgqQzJMwTgBgZRkMOXgPhXWguoUgYPh+d
6RCEs1p7FYg4YHHYwNiezxSFWctUd/AZ8i2rrFFzyeBTLZ2X5Vpac5MnTYhrPtc6
bcbZ3b9/xZTTqx/cNLnj6N+33tv+fGOf+mXgq6vmvDe5tH8B+b1z52stLz/cs35i
+wqY49PbcP/iW754rHDyzRn5P/DlJ9cunrnl86mzGidE1zdyV/X4W1M75nx259st
w62rSrtye4fdjaNXru5//Ms912/dPnRb+7SN357SM4dWXvvRkdPf+UP3tA1dN+fX
tp++nrH05t3bN9/Xs/GGu+7Pd299+sm2aX8dWDqq525Zf2rhj1ePyG140dEX0IYd
8+Bz8/NL5v3wzqzbNx/evsGPvPj69CUnRiftGfFv7N2Z731p3x3Fdw92HDn+zLH6
0K7lE/+cv7xr8aKuT/pGbtowd0Lvx8Wp27JC55Tflr3/ygfDrx6b8OmOZ1fN3v3E
Pw==
=oaDo
-----END PGP MESSAGE-----
...we get output...
pbpaste | gpg --list-packets
:compressed packet: algo=1
:onepass_sig packet: keyid CC19461E16CD52C8
version 3, sigclass 0x00, digest 10, pubkey 1, last=1
:literal data packet:
mode b (62), created 1389029088, name="",
raw data: unknown length
The problem is twofold: first, that the raw data length is unknown, and second, that the signature
packet that's supposed to come last is missing. Why is that happening?
More research. This works:
head -c 505 x | gpg -u browhat --sign -a | gpg --list-packets
This doesn't:
head -c 506 x | gpg -u browhat --sign -a | gpg --list-packets
For some random file x
The former outputs
:compressed packet: algo=1
:onepass_sig packet: keyid CC19461E16CD52C8
version 3, sigclass 0x00, digest 10, pubkey 1, last=1
:literal data packet:
mode b (62), created 1389133126, name="",
raw data: 505 bytes
:signature packet: algo 1, keyid CC19461E16CD52C8
version 4, created 1389133126, md5len 0, sigclass 0x00
digest algo 10, begin of digest 26 50
hashed subpkt 2 len 4 (sig created 2014-01-07)
subpkt 16 len 8 (issuer key ID CC19461E16CD52C8)
data: [2047 bits]
The latter:
:compressed packet: algo=1
:onepass_sig packet: keyid CC19461E16CD52C8
version 3, sigclass 0x00, digest 10, pubkey 1, last=1
:literal data packet:
mode b (62), created 1389133129, name="",
raw data: unknown length
Btw, this issue above with --list-packets
was not a problem with my 1.X version of GPG running on Linux.
taco1: bad key: B707AD86 != 96D307BE
This only happens after we've signed a key for inclusion into our keyring. Before inclusion, it spits out the full PGP fingerprint, which is actually better!