git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 8/8] gpg-interface: handle alternative signature types

From
Ben Toews <mastahyeti@gmail.com>
Date
Apr 10, 2018, 16:01 UTC
Message-ID
<CAE=pOyHey_8kJ0JsA3ROhpE9qn+HivVQgwd+Wdonw8L6D+9MUg@mail.gmail.com>
In-Reply-To
<xmqqr2nn2ylz.fsf@gitster-ct.c.googlers.com>
On Tue, Apr 10, 2018 at 3:35 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 58 quoted lines
> Ben Toews <mastahyeti@gmail.com> writes:
>
>> From: Ben Toews <btoews@github.com>
>>
>> Currently you can only sign commits and tags using "gpg".
>> ...
>> have asked before on the list about using OpenBSD signify).
>> ---
>
> Missing sign-off.
>
>> -gpg.program::
>> -     Use this custom program instead of "`gpg`" found on `$PATH` when
>> -     making or verifying a PGP signature. The program must support the
>> -     same command-line interface as GPG, namely, to verify a detached
>> -     signature, "`gpg --verify $file - <$signature`" is run, and the
>> -     program is expected to signal a good signature by exiting with
>> -     code 0, and to generate an ASCII-armored detached signature, the
>> -     standard input of "`gpg -bsau $key`" is fed with the contents to be
>> +signingtool.<name>.program::
>> +     The name of the program on `$PATH` to execute when making or
>> +     verifying a signature.
>
> I think you do not want "on `$PATH`", as you should be able to
> specify a full path /opt/some/where/not/on/my/path/pgp and have it
> work just fine.  The mention of "found on `$PATH`" in the original
> is talking about the behaviour _WITHOUT_ the configuration, i.e. by
> default we just invoke "gpg" and expect that it is found in the
> usual measure, i.e. being on user's $PATH.  What you are describing
> in this updated explanation is what happens _WITH_ the configuration.
>
>> +     This program will be used for making
>> +     signatures if `<name>` is configured as `signingtool.default`.
>> +     This program will be used for verifying signatures whose PEM
>> +     block type matches `signingtool.<name>.pemtype` (see below). The
>> +     program must support the same command-line interface as GPG.
>> +     To verify a detached signature,
>> +     "`gpg --verify $file - <$signature`" is run, and the program is
>> +     expected to signal a good signature by exiting with code 0.
>> +     To generate an ASCII-armored detached signature, the standard
>> +     input of "`gpg -bsau $key`" is fed with the contents to be
>>       signed, and the program is expected to send the result to its
>> -     standard output.
>> +     standard output. By default, `signingtool.gpg.program` is set to
>> +     `gpg`.
>
> I do not think the description is wrong per-se, but reading it made
> me realize that with this "custom" program, you still require that
> the "custom" program MUST accept the command line options as if it
> were an implementation of GPG.  Most likely you'd write a thin
> wrapper to call your custom program with whatever options that are
> appropriate when asked to --verify or -bsau (aka "sign")?  If that
> is the case, I have to wonder if such a wrappper program can also
> trivially reformat the --- BEGIN WHATEVER --- block and behave as if
> it were an implementation of GPG.  That makes the primary point of
> this long series somewhat moot, as we won't need that pemtype thing
> at all, no?
>

Just because a signature is PEM encoded and claims to be a "PGP SIGNATURE", doesn't mean it can be understood or verified by a PGP implementation. Without different tools specifying different PEM types we would have no way of knowing which tool to route the signature to for verification.

Show 25 quoted lines
>> +signingtool.<name>.pemtype::
>> +     The PEM block type associated with the signing tool named
>> +     `<name>`. For example, the block type of a GPG signature
>> +     starting with `-----BEGIN PGP SIGNATURE-----` is `PGP
>> +     SIGNATURE`. When verifying a signature with this PEM block type
>> +     the program specified in `signingtool.<name>.program` will be
>> +     used. By default `signingtool.gpg.pemtype` contains `PGP
>> +     SIGNATURE` and `PGP MESSAGE`.
>
> As Eric noted elsewhere, I suspect that it is cleaner and more
> useful if this were *NOT* "pemtype" but were "boundary", i.e.
> letting "-----BEGIN PGP SIGNATURE-----\n" string be specified.
>
>> +signingtool.default::
>> +     The `<name>` of the signing tool to use when creating
>> +     signatures (e.g., setting it to "foo" will use use the program
>> +     specified by `signingtool.foo.program`). Defaults to `gpg`.
>
> Will there be a command line option to say "I may usually be using
> whatever I configured with signingtool.default, but for this single
> invocation only, let me use something else"?  Without such a command
> line option that overrides such a default, I do not quite get the
> point of adding this configuration variable.
>
> Thanks.
-- 
-Ben Toews
Previous: Junio C HamanoNext: SZEDER Gábor
Message 35 of 46 in “gpg-interface: Multiple signing tools”
  1. 0/8 gpg-interface: Multiple signing toolsBen Toews, Apr 9, 2018
  2. 1/8 gpg-interface: handle bool user.signingkeyBen Toews, Apr 9, 2018
  3. Eric SunshineApr 9, 2018
  4. Jeff KingApr 10, 2018
  5. 3/8 gpg-interface: use size_t for signature buffer sizeBen Toews, Apr 9, 2018
  6. 2/8 gpg-interface: modernize function declarationsBen Toews, Apr 9, 2018
  7. 4/8 gpg-interface: fix const-correctness of "eol" pointerBen Toews, Apr 9, 2018
  8. 5/8 gpg-interface: extract gpg line matching helperBen Toews, Apr 9, 2018
  9. 7/8 gpg-interface: prepare for parsing arbitrary PEM blocksBen Toews, Apr 9, 2018
  10. 6/8 gpg-interface: find the last gpg signature lineBen Toews, Apr 9, 2018
  11. Eric SunshineApr 9, 2018
  12. Junio C HamanoApr 10, 2018
  13. Ben ToewsApr 10, 2018
  14. Junio C HamanoApr 10, 2018
  15. Junio C HamanoApr 10, 2018
  16. Ben ToewsApr 11, 2018
  17. 8/8 gpg-interface: handle alternative signature typesBen Toews, Apr 9, 2018
  18. Stefan BellerApr 9, 2018
  19. Eric SunshineApr 10, 2018
  20. Ben ToewsApr 10, 2018
  21. brian m. carlsonApr 14, 2018
  22. Junio C HamanoApr 16, 2018
  23. brian m. carlsonApr 17, 2018
  24. Junio C HamanoApr 17, 2018
  25. Ben ToewsApr 17, 2018
  26. Taylor BlauApr 17, 2018
  27. Ben ToewsMay 3, 2018
  28. Jeff KingMay 7, 2018
  29. Junio C HamanoMay 7, 2018
  30. brian m. carlsonMay 7, 2018
  31. Jeff KingMay 8, 2018
  32. brian m. carlsonMay 8, 2018
  33. Jeff KingMay 9, 2018
  34. Junio C HamanoApr 10, 2018
  35. Ben ToewsApr 10, 2018
  36. SZEDER GáborApr 11, 2018
  37. 0/9 gpg-interface: Multiple signing toolsBen Toews, Apr 13, 2018
  38. 2/9 gpg-interface: handle bool user.signingkeyBen Toews, Apr 13, 2018
  39. 3/9 gpg-interface: modernize function declarationsBen Toews, Apr 13, 2018
  40. 1/9 t7004: fix mistaken tag nameBen Toews, Apr 13, 2018
  41. 8/9 gpg-interface: prepare for parsing arbitrary PEM blocksBen Toews, Apr 13, 2018
  42. 4/9 gpg-interface: use size_t for signature buffer sizeBen Toews, Apr 13, 2018
  43. 5/9 gpg-interface: fix const-correctness of "eol" pointerBen Toews, Apr 13, 2018
  44. 6/9 gpg-interface: extract gpg line matching helperBen Toews, Apr 13, 2018
  45. 7/9 gpg-interface: find the last gpg signature lineBen Toews, Apr 13, 2018
  46. 9/9 gpg-interface: handle alternative signature typesBen Toews, Apr 13, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.