<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/gpg-interface.h, branch v2.51.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.51.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.51.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2025-07-09T23:08:29Z</updated>
<entry>
<title>fast-(import|export): improve on commit signature output format</title>
<updated>2025-07-09T23:08:29Z</updated>
<author>
<name>Christian Couder</name>
<email>christian.couder@gmail.com</email>
</author>
<published>2025-07-09T14:12:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b5b3ddbe5c56c7ded95e7c47c985dc6d61f73ea0'/>
<id>urn:sha1:b5b3ddbe5c56c7ded95e7c47c985dc6d61f73ea0</id>
<content type='text'>
A recent commit, d9cb0e6ff8 (fast-export, fast-import: add support for
signed-commits, 2025-03-10), added support for signed commits to
fast-export and fast-import.

When a signed commit is processed, fast-export can output either
"gpgsig sha1" or "gpgsig sha256" depending on whether the signed
commit uses the SHA-1 or SHA-256 Git object format.

However, this implementation has a number of limitations:

  - the output format was not properly described in the documentation,
  - the output format is not very informative as it doesn't even say
    if the signature is an OpenPGP, an SSH, or an X509 signature,
  - the implementation doesn't support having both one signature on
    the SHA-1 object and one on the SHA-256 object.

Let's improve on these limitations by improving fast-export and
fast-import so that:

  - all the signatures are exported,
  - at most one signature on the SHA-1 object and one on the SHA-256
    are imported,
  - if there is more than one signature on the SHA-1 object or on
    the SHA-256 object, fast-import emits a warning for each
    additional signature,
  - the output format is "gpgsig &lt;git-hash-algo&gt; &lt;signature-format&gt;",
    where &lt;git-hash-algo&gt; is the Git object format as before, and
    &lt;signature-format&gt; is the signature type ("openpgp", "x509",
    "ssh" or "unknown"),
  - the output is properly documented.

About the output format:

  - &lt;git-hash-algo&gt; allows to know which representation of the commit
    was signed (the SHA-1 or the SHA-256 version) which helps with
    both signature verification and interoperability between repos
    with different hash functions,

  - &lt;signature-format&gt; helps tools that process the fast-export
    stream, so they don't have to parse the ASCII armor to identify
    the signature type.

It could be even better to be able to import more than one signature
on the SHA-1 object and on the SHA-256 object, but other parts of
Git don't handle that well for now, so this is left for future
improvements.

Helped-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Helped-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>gpg-interface: fix misdesigned signing key interfaces</title>
<updated>2024-09-05T15:49:11Z</updated>
<author>
<name>Patrick Steinhardt</name>
<email>ps@pks.im</email>
</author>
<published>2024-09-05T10:09:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b8849e236f7a32d43ab3ba087587a336d69329b0'/>
<id>urn:sha1:b8849e236f7a32d43ab3ba087587a336d69329b0</id>
<content type='text'>
The interfaces to retrieve signing keys and their IDs are misdesigned as
they return string constants even though they indeed allocate memory,
which leads to memory leaks. Refactor the code to instead always return
allocated strings and let the callers free them accordingly.

Signed-off-by: Patrick Steinhardt &lt;ps@pks.im&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>tag: fix sign_buffer() call to create a signed tag</title>
<updated>2024-02-07T18:47:25Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-02-07T18:46:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=abfbff61efc4d91dc964eb2360760fa640ad0f0f'/>
<id>urn:sha1:abfbff61efc4d91dc964eb2360760fa640ad0f0f</id>
<content type='text'>
The command "git tag -s" internally calls sign_buffer() to make a
cryptographic signature using the chosen backend like GPG and SSH.
The internal helper functions used by "git tag" implementation seem
to use a "negative return values are errors, zero or positive return
values are not" convention, and there are places (e.g., verify_tag()
that calls gpg_verify_tag()) that these internal helper functions
translate return values that signal errors to conform to this
convention, but do_sign() that calls sign_buffer() forgets to do so.

Fix it, so that a failed call to sign_buffer() that can return the
exit status from pipe_command() will not be overlooked.

Reported-by: Sergey Kosukhin &lt;skosukhin@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>gpg-interface: lazily initialize and read the configuration</title>
<updated>2023-02-10T01:01:27Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2023-02-09T20:24:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fd2d4c135ed974fdddf2af687748d28c58575984'/>
<id>urn:sha1:fd2d4c135ed974fdddf2af687748d28c58575984</id>
<content type='text'>
Instead of forcing the porcelain commands to always read the
configuration variables related to the signing and verifying
signatures, lazily initialize the necessary subsystem on demand upon
the first use.

This hopefully would make it more future-proof as we do not have to
think and decide whether we should call git_gpg_config() in the
git_config() callback for each command.

A few git_config() callback functions that used to be custom
callbacks are now just a thin wrapper around git_default_config().
We could further remove, git_FOO_config and replace calls to
git_config(git_FOO_config) with git_config(git_default_config), but
to make it clear which ones are affected and the effect is only the
removal of git_gpg_config(), it is vastly preferred not to do such a
change in this step (they can be done on top once the dust settled).

Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>gpg-interface: add function for converting trust level to string</title>
<updated>2022-07-11T05:10:23Z</updated>
<author>
<name>Jaydeep Das</name>
<email>jaydeepjd.8914@gmail.com</email>
</author>
<published>2022-07-11T05:00:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=803978da494bf88ee60fb9598c94e25d601c5c32'/>
<id>urn:sha1:803978da494bf88ee60fb9598c94e25d601c5c32</id>
<content type='text'>
Add new helper function `gpg_trust_level_to_str()` which will
convert a given member of `enum signature_trust_level` to its
corresponding string (in lowercase). For example, `TRUST_ULTIMATE`
will yield the string "ultimate".

This will abstract out some code in `pretty.c` relating to gpg
signature trust levels.

Mentored-by: Christian Couder &lt;chriscool@tuxfamily.org&gt;
Mentored-by: Hariom Verma &lt;hariom18599@gmail.com&gt;
Signed-off-by: Jaydeep Das &lt;jaydeepjd.8914@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>ssh signing: make verify-commit consider key lifetime</title>
<updated>2021-12-09T21:38:04Z</updated>
<author>
<name>Fabian Stelzer</name>
<email>fs@gigacodes.de</email>
</author>
<published>2021-12-09T08:52:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6393c956f4e7061d6b19981bd8cd28ef037b911e'/>
<id>urn:sha1:6393c956f4e7061d6b19981bd8cd28ef037b911e</id>
<content type='text'>
If valid-before/after dates are configured for this signatures key in the
allowedSigners file then the verification should check if the key was valid at
the time the commit was made. This allows for graceful key rollover and
revoking keys without invalidating all previous commits.
This feature needs openssh &gt; 8.8. Older ssh-keygen versions will simply
ignore this flag and use the current time.
Strictly speaking this feature is available in 8.7, but since 8.7 has a
bug that makes it unusable in another needed call we require 8.8.

Timestamp information is present on most invocations of check_signature.
However signer ident is not. We will need the signer email / name to be able
to implement "Trust on first use" functionality later.
Since the payload contains all necessary information we can parse it
from there. The caller only needs to provide us some info about the
payload by setting payload_type in the signature_check struct.

 - Add payload_type field &amp; enum and payload_timestamp to struct
   signature_check
 - Populate the timestamp when not already set if we know about the
   payload type
 - Pass -Overify-time={payload_timestamp} in the users timezone to all
   ssh-keygen verification calls
 - Set the payload type when verifying commits
 - Add tests for expired, not yet valid and keys having a commit date
   outside of key validity as well as within

Signed-off-by: Fabian Stelzer &lt;fs@gigacodes.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>ssh signing: use sigc struct to pass payload</title>
<updated>2021-12-09T21:38:04Z</updated>
<author>
<name>Fabian Stelzer</name>
<email>fs@gigacodes.de</email>
</author>
<published>2021-12-09T08:52:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=02769437e1421d837f6de27cfb5c14087cfec8dd'/>
<id>urn:sha1:02769437e1421d837f6de27cfb5c14087cfec8dd</id>
<content type='text'>
To be able to extend the payload metadata with things like its creation
timestamp or the creators ident we remove the payload parameters to
check_signature() and use the already existing sigc-&gt;payload field
instead, only adding the length field to the struct. This also allows
us to get rid of the xmemdupz() calls in the verify functions. Since
sigc is now used to input data as well as output the result move it to
the front of the function list.

 - Add payload_length to struct signature_check
 - Populate sigc.payload/payload_len on all call sites
 - Remove payload parameters to check_signature()
 - Remove payload parameters to internal verify_* functions and use sigc
   instead
 - Remove xmemdupz() used for verbose output since payload is now already
   populated.

Signed-off-by: Fabian Stelzer &lt;fs@gigacodes.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>ssh signing: provide a textual signing_key_id</title>
<updated>2021-09-10T21:15:52Z</updated>
<author>
<name>Fabian Stelzer</name>
<email>fs@gigacodes.de</email>
</author>
<published>2021-09-10T20:07:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4838f62c8caffbfe5d7d39cad4e8aeb2a2d57da8'/>
<id>urn:sha1:4838f62c8caffbfe5d7d39cad4e8aeb2a2d57da8</id>
<content type='text'>
For ssh the user.signingkey can be a filename/path or even a literal ssh pubkey.
In push certs and textual output we prefer the ssh fingerprint instead.

Signed-off-by: Fabian Stelzer &lt;fs@gigacodes.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>ssh signing: preliminary refactoring and clean-up</title>
<updated>2021-09-10T21:15:51Z</updated>
<author>
<name>Fabian Stelzer</name>
<email>fs@gigacodes.de</email>
</author>
<published>2021-09-10T20:07:34Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b5726a5d9cabba0bd8fb6c1b25a887bc7ea4650d'/>
<id>urn:sha1:b5726a5d9cabba0bd8fb6c1b25a887bc7ea4650d</id>
<content type='text'>
Openssh v8.2p1 added some new options to ssh-keygen for signature
creation and verification. These allow us to use ssh keys for git
signatures easily.

In our corporate environment we use PIV x509 Certs on Yubikeys for email
signing/encryption and ssh keys which I think is quite common
(at least for the email part). This way we can establish the correct
trust for the SSH Keys without setting up a separate GPG Infrastructure
(which is still quite painful for users) or implementing x509 signing
support for git (which lacks good forwarding mechanisms).
Using ssh agent forwarding makes this feature easily usable in todays
development environments where code is often checked out in remote VMs / containers.
In such a setup the keyring &amp; revocationKeyring can be centrally
generated from the x509 CA information and distributed to the users.

To be able to implement new signing formats this commit:
 - makes the sigc structure more generic by renaming "gpg_output" to
   "output"
 - introduces function pointers in the gpg_format structure to call
   format specific signing and verification functions
 - moves format detection from verify_signed_buffer into the check_signature
   api function and calls the format specific verify
 - renames and wraps sign_buffer to handle format specific signing logic
   as well

Signed-off-by: Fabian Stelzer &lt;fs@gigacodes.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>gpg-interface: improve interface for parsing tags</title>
<updated>2021-02-11T07:35:42Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2021-02-11T02:08:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=482c119186987110bfccf705a5ac75d399b08766'/>
<id>urn:sha1:482c119186987110bfccf705a5ac75d399b08766</id>
<content type='text'>
We have a function which parses a buffer with a signature at the end,
parse_signature, and this function is used for signed tags.  However,
we'll need to store values for multiple algorithms, and we'll do this by
using a header for the non-default algorithm.

Adjust the parse_signature interface to store the parsed data in two
strbufs and turn the existing function into parse_signed_buffer.  The
latter is still used in places where we know we always have a signed
buffer, such as push certs.

Adjust all the callers to deal with this new interface.

Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
