From: Jeff King <peff@peff.net>
To: "Carlos Martín Nieto" <cmn@dwim.me>
Cc: git@vger.kernel.org
Subject: Re: [RFC PATCH] gpg: add support for gpgsm
Date: Thu, 31 Mar 2016 10:22:00 -0400 [thread overview]
Message-ID: <20160331142200.GB31116@sigill.intra.peff.net> (raw)
In-Reply-To: <1459432304-35779-1-git-send-email-cmn@dwim.me>
On Thu, Mar 31, 2016 at 03:51:44PM +0200, Carlos Martín Nieto wrote:
> Detect the gpgsm block header and run this command instead of gpg.
This part makes sense to me, and is a strict improvement (though
offhand, I wonder if any other systems use the generic "BEGIN SIGNED
MESSAGE" header. The obvious option would be PEM from "openssl smime",
but it is "BEGIN PKCS7").
> On the signing side, ask gpgsm if it knows the signing key we're trying
> to use and fall back to gpg if it does not.
This part looks like we incur an extra fork/exec each time we sign with
gpg, even if the user doesn't ever want to use gpgsm, or even have it
installed.
I wonder if there are any hints we can use from the key ident, but I
suppose not. In the default config, it comes straight from
$GIT_COMMITTER_*, and is just a name/email.
But maybe we could pull this out to a separate config option, like
"commit.defaultSignatureType", which could be either "gpg", "gpgsm", or
"auto" to enable the behavior you have here. Then savvy users can pick
the type they plan to use. We can have a discussion then about whether
to flip the default from "gpg" to "auto", but I'd vote to leave it at
gpg unless gpgsm gets a huge amount of traction, and it really is 50/50
what people would want.
And regardless of the default type for creating signatures, we'd still
automatically verify signatures from either type.
> /*
> + * Try to figure out if the given program contains given the key. Both
> + * gpg and gpgsm have keys in hex format, so we don't necessarily know
> + * which one to use.
> + */
> +static int program_knows_key(const char *program, const char *signing_key)
> +{
> + struct child_process gpg = CHILD_PROCESS_INIT;
> + struct strbuf output = STRBUF_INIT;
> + const char *args[4];
> + size_t len;
> +
> + gpg.argv = args;
> + gpg.in = -1;
> + gpg.out = -1;
> + args[0] = program;
> + args[1] = "-K";
> + args[2] = signing_key;
> + args[3] = NULL;
I think you'd want to send stderr to /dev/null here, as this is for
speculatively seeing "does the user even have gpgsm set up?".
> +
> + if (start_command(&gpg))
> + return error(_("could not run '%s'"), program);
Likewise, most users would start seeing "could not run 'gpgsm'" if they
do not even have it installed.
-Peff
next prev parent reply other threads:[~2016-03-31 14:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-31 13:51 [RFC PATCH] gpg: add support for gpgsm Carlos Martín Nieto
2016-03-31 14:22 ` Jeff King [this message]
2016-03-31 14:44 ` Carlos Martín Nieto
2016-03-31 15:49 ` Junio C Hamano
2016-03-31 15:46 ` Junio C Hamano
2016-03-31 15:57 ` Jeff King
2016-03-31 16:08 ` Carlos Martín Nieto
2016-03-31 17:30 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160331142200.GB31116@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=cmn@dwim.me \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).