Skip to content

Commit 31a431b

Browse files
gwymorgitster
authored andcommitted
signature-format.txt: note SSH and X.509 signature delimiters
This document only explains PGP signatures, but Git now supports X.509 signatures as of 1e7adb9 (gpg-interface: introduce new signature format "x509" using gpgsm, 2018-07-17), and SSH signatures as of 29b3157 (ssh signing: add ssh key format and signing code, 2021-09-10). Additionally, explain that these signature formats are controlled `gpg.format`, linking to its documentation, and explain in said `gpg.format` documentation that the underlying signature format is documented in signature-format.txt. Signed-off-by: Gwyneth Morgan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7556e5d commit 31a431b

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

Documentation/config/gpg.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ gpg.program::
1212
gpg.format::
1313
Specifies which key format to use when signing with `--gpg-sign`.
1414
Default is "openpgp". Other possible values are "x509", "ssh".
15+
+
16+
See linkgit:gitformat-signature[5] for the signature format, which differs
17+
based on the selected `gpg.format`.
1518

1619
gpg.<format>.program::
1720
Use this to customize the program used for the signing format you

Documentation/gitformat-signature.txt

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,24 @@ DESCRIPTION
1717
Git uses cryptographic signatures in various places, currently objects (tags,
1818
commits, mergetags) and transactions (pushes). In every case, the command which
1919
is about to create an object or transaction determines a payload from that,
20-
calls gpg to obtain a detached signature for the payload (`gpg -bsa`) and
21-
embeds the signature into the object or transaction.
20+
calls an external program to obtain a detached signature for the payload
21+
(`gpg -bsa` in the case of PGP signatures), and embeds the signature into the
22+
object or transaction.
2223

23-
Signatures always begin with `-----BEGIN PGP SIGNATURE-----`
24-
and end with `-----END PGP SIGNATURE-----`, unless gpg is told to
25-
produce RFC1991 signatures which use `MESSAGE` instead of `SIGNATURE`.
24+
Signatures begin with an "ASCII Armor" header line and end with a tail line,
25+
which differ depending on signature type (as selected by `gpg.format`, see
26+
linkgit:git-config[1]). These are, for `gpg.format` values:
27+
28+
`gpg` (PGP)::
29+
`-----BEGIN PGP SIGNATURE-----` and `-----END PGP SIGNATURE-----`.
30+
Or, if gpg is told to produce RFC1991 signatures,
31+
`-----BEGIN PGP MESSAGE-----` and `-----END PGP MESSAGE-----`
32+
33+
`ssh` (SSH)::
34+
`-----BEGIN SSH SIGNATURE-----` and `-----END SSH SIGNATURE-----`
35+
36+
`x509` (X.509)::
37+
`-----BEGIN SIGNED MESSAGE-----` and `-----END SIGNED MESSAGE-----`
2638

2739
Signatures sometimes appear as a part of the normal payload
2840
(e.g. a signed tag has the signature block appended after the payload

0 commit comments

Comments
 (0)