Re: [PATCH] Add commit & tag signing/verification via SSH keys using ssh-keygen
- From
Fabian Stelzer <fs@gigacodes.de>
- Date
- Jul 7, 2021, 08:48 UTC
- Message-ID
- <f4a5f0a5-8713-4640-e351-69b265c74460@gigacodes.de>
- In-Reply-To
- <92d8ae43-f146-e938-d793-b8b67d810130@gmail.com>
On 07.07.21 08:26, Bagas Sanjaya wrote:
Show 23 quoted lines
> On 06/07/21 15.19, Fabian Stelzer via GitGitGadget wrote: >> From: Fabian Stelzer <fs@gigacodes.de> >> >> set gpg.format = ssh and user.signingkey to a ssh public key string >> (like from an >> authorized_keys file) and commits/tags can be signed using the private >> key from your ssh-agent. >> >> Verification uses a allowed_signers_file (see ssh-keygen(1)) which >> defaults to .gitsigners but can be set via gpg.ssh.allowedsigners >> A possible gpg.ssh.revocationfile is also passed to ssh-keygen on >> verification. >> >> needs openssh>8.2p1 >> > > Why did you choose to implement SSH-based signing as GPG interface? > Why not create similar one? > > If at later times we need to implement other signing methods (besides > GPG and SSH), we can refactor gpg-interface into generic signing > interface (say `signing.h`) and let each signing methods implement > from it.
I agree that a general purpose "signing" would be cleaner. The GPG kewords are scattered all over the codebase but all the paths i found just call the generic sign_buffer / verify_signed_buffer from gpg-interface.c in the end whose api works quite well for other signing mechanisms as well. I will rename some struct fields to be more generic and adjust a few messages printed to the user which currently say things like "gpg failed to sign the data" or "has a gpg signature" to be generic. Do we just want to call this "signature" and remove the gpg prefix or would that be too generic?
Refactoring the whole gpg part to a generic "signing" would be quite involved and should probably be a different patch even though its mostly renaming stuff. If we want to go into that direction i could add the new config keys under signing.* (signing.format = ssh|gpg, ...) and keep the compatibility for the older gpg.* keys.