So as an exercise im trying to figure out how to locally verify a git commit signature.
As an example I am using https://github.com/ethereum/go-ethereum/commit/0a68558e7e025afebf67b81bf48ecb8b0fa7c06d.
The public key for this sig is https://github.com/web-flow.gpg.
When I run the following
git verify-commit 0a68558e7e025afebf67b81bf48ecb8b0fa7c06d
The result I get is that it is valid commit.
However I want to figure out a way to write a script to do this.
I have defined two files
commit.txt
commit 0a68558e7e025afebf67b81bf48ecb8b0fa7c06d
Author: Péter Szilágyi <peterke@gmail.com>
Date: Fri Aug 13 15:39:51 2021 +0300
accounts/external: handle 0 chainid as not-set for the Clef API (#23394)
* accounts/external: handle 0 chainid as not-set for the Clef API
* accounts/external: document SignTx
Co-authored-by: Felix Lange <fjl@twurst.com>
And using git cat-file -p <commit-hash>
I get the signature and store it in a file doc.sig
-----BEGIN PGP SIGNATURE-----
wsBcBAABCAAQBQJhFmgXCRBK7hj4Ov3rIwAAkpoIACFP0wLY/5WA3rHgrU2s/6lT
DdTOK7HNnh00bJIEplGoVvMWku0mAHAgp8t+oerhQlwHC8quBIxo9ozzz7UBj0Aa
3VjFSBXnX5KCkW8kY8ZxT4xnuXgFJ/O5z59qSh+3S1Lt/B6c2ERP+3T6oylR+LMt
/Icr901l24kRKNOkjM6cM5jDGVpD+7CLQQKmwcq8A5Ee14EF+H2+/XaFJmilYhfL
r/BY4aPvQDP18vhwTKOVTpVzGmjLn/i0OU6kAfcY2LSzhfSJ0rlenQ0JQE4kK9KM
dh1E8WvySYOh7WD9iKkNPP2VbXuPoNaVQIwkJ06kab8edvKw1qQsWpogMtKlQAI=
=qe4m
-----END PGP SIGNATURE-----
However when I run
gpg verify doc.sig commit.txt
I get the following
gpg: Signature made Fri Aug 13 05:39:51 2021 PDT
gpg: using RSA key 4AEE18F83AFDEB23
gpg: BAD signature from "GitHub (web-flow commit signing) <noreply@github.com>" [unknown]
I get a similar result when trying to run verify the signature via openpgpjs script https://github.com/openpgpjs/openpgpjs
Anyone have an idea as to what i might be doing wrong.