|
| 1 | +Git signature format |
| 2 | +==================== |
| 3 | + |
| 4 | +== Overview |
| 5 | + |
| 6 | +Git uses cryptographic signatures in various places, currently objects (tags, |
| 7 | +commits, mergetags) and transactions (pushes). In every case, the command which |
| 8 | +is about to create an object or transaction determines a payload from that, |
| 9 | +calls gpg to obtain a detached signature for the payload (`gpg -bsa`) and |
| 10 | +embeds the signature into the object or transaction. |
| 11 | + |
| 12 | +Signatures always begin with `-----BEGIN PGP SIGNATURE-----` |
| 13 | +and end with `-----END PGP SIGNATURE-----`, unless gpg is told to |
| 14 | +produce RFC1991 signatures which use `MESSAGE` instead of `SIGNATURE`. |
| 15 | + |
| 16 | +The signed payload and the way the signature is embedded depends |
| 17 | +on the type of the object resp. transaction. |
| 18 | + |
| 19 | +== Tag signatures |
| 20 | + |
| 21 | +- created by: `git tag -s` |
| 22 | +- payload: annotated tag object |
| 23 | +- embedding: append the signature to the unsigned tag object |
| 24 | +- example: tag `signedtag` with subject `signed tag` |
| 25 | + |
| 26 | +---- |
| 27 | +object 04b871796dc0420f8e7561a895b52484b701d51a |
| 28 | +type commit |
| 29 | +tag signedtag |
| 30 | +tagger C O Mitter < [email protected]> 1465981006 +0000 |
| 31 | + |
| 32 | +signed tag |
| 33 | + |
| 34 | +signed tag message body |
| 35 | +-----BEGIN PGP SIGNATURE----- |
| 36 | +Version: GnuPG v1 |
| 37 | + |
| 38 | +iQEcBAABAgAGBQJXYRhOAAoJEGEJLoW3InGJklkIAIcnhL7RwEb/+QeX9enkXhxn |
| 39 | +rxfdqrvWd1K80sl2TOt8Bg/NYwrUBw/RWJ+sg/hhHp4WtvE1HDGHlkEz3y11Lkuh |
| 40 | +8tSxS3qKTxXUGozyPGuE90sJfExhZlW4knIQ1wt/yWqM+33E9pN4hzPqLwyrdods |
| 41 | +q8FWEqPPUbSJXoMbRPw04S5jrLtZSsUWbRYjmJCHzlhSfFWW4eFd37uquIaLUBS0 |
| 42 | +rkC3Jrx7420jkIpgFcTI2s60uhSQLzgcCwdA2ukSYIRnjg/zDkj8+3h/GaROJ72x |
| 43 | +lZyI6HWixKJkWw8lE9aAOD9TmTW9sFJwcVAzmAuFX2kUreDUKMZduGcoRYGpD7E= |
| 44 | +=jpXa |
| 45 | +-----END PGP SIGNATURE----- |
| 46 | +---- |
| 47 | + |
| 48 | +- verify with: `git verify-tag [-v]` or `git tag -v` |
| 49 | + |
| 50 | +---- |
| 51 | +gpg: Signature made Wed Jun 15 10:56:46 2016 CEST using RSA key ID B7227189 |
| 52 | +gpg: Good signature from "Eris Discordia < [email protected]>" |
| 53 | +gpg: WARNING: This key is not certified with a trusted signature! |
| 54 | +gpg: There is no indication that the signature belongs to the owner. |
| 55 | +Primary key fingerprint: D4BE 2231 1AD3 131E 5EDA 29A4 6109 2E85 B722 7189 |
| 56 | +object 04b871796dc0420f8e7561a895b52484b701d51a |
| 57 | +type commit |
| 58 | +tag signedtag |
| 59 | +tagger C O Mitter < [email protected]> 1465981006 +0000 |
| 60 | + |
| 61 | +signed tag |
| 62 | + |
| 63 | +signed tag message body |
| 64 | +---- |
| 65 | + |
| 66 | +== Commit signatures |
| 67 | + |
| 68 | +- created by: `git commit -S` |
| 69 | +- payload: commit object |
| 70 | +- embedding: header entry `gpgsig` |
| 71 | + (content is preceded by a space) |
| 72 | +- example: commit with subject `signed commit` |
| 73 | + |
| 74 | +---- |
| 75 | +tree eebfed94e75e7760540d1485c740902590a00332 |
| 76 | +parent 04b871796dc0420f8e7561a895b52484b701d51a |
| 77 | +author A U Thor < [email protected]> 1465981137 +0000 |
| 78 | +committer C O Mitter < [email protected]> 1465981137 +0000 |
| 79 | +gpgsig -----BEGIN PGP SIGNATURE----- |
| 80 | + Version: GnuPG v1 |
| 81 | + |
| 82 | + iQEcBAABAgAGBQJXYRjRAAoJEGEJLoW3InGJ3IwIAIY4SA6GxY3BjL60YyvsJPh/ |
| 83 | + HRCJwH+w7wt3Yc/9/bW2F+gF72kdHOOs2jfv+OZhq0q4OAN6fvVSczISY/82LpS7 |
| 84 | + DVdMQj2/YcHDT4xrDNBnXnviDO9G7am/9OE77kEbXrp7QPxvhjkicHNwy2rEflAA |
| 85 | + zn075rtEERDHr8nRYiDh8eVrefSO7D+bdQ7gv+7GsYMsd2auJWi1dHOSfTr9HIF4 |
| 86 | + HJhWXT9d2f8W+diRYXGh4X0wYiGg6na/soXc+vdtDYBzIxanRqjg8jCAeo1eOTk1 |
| 87 | + EdTwhcTZlI0x5pvJ3H0+4hA2jtldVtmPM4OTB0cTrEWBad7XV6YgiyuII73Ve3I= |
| 88 | + =jKHM |
| 89 | + -----END PGP SIGNATURE----- |
| 90 | + |
| 91 | +signed commit |
| 92 | + |
| 93 | +signed commit message body |
| 94 | +---- |
| 95 | + |
| 96 | +- verify with: `git verify-commit [-v]` (or `git show --show-signature`) |
| 97 | + |
| 98 | +---- |
| 99 | +gpg: Signature made Wed Jun 15 10:58:57 2016 CEST using RSA key ID B7227189 |
| 100 | +gpg: Good signature from "Eris Discordia < [email protected]>" |
| 101 | +gpg: WARNING: This key is not certified with a trusted signature! |
| 102 | +gpg: There is no indication that the signature belongs to the owner. |
| 103 | +Primary key fingerprint: D4BE 2231 1AD3 131E 5EDA 29A4 6109 2E85 B722 7189 |
| 104 | +tree eebfed94e75e7760540d1485c740902590a00332 |
| 105 | +parent 04b871796dc0420f8e7561a895b52484b701d51a |
| 106 | +author A U Thor < [email protected]> 1465981137 +0000 |
| 107 | +committer C O Mitter < [email protected]> 1465981137 +0000 |
| 108 | + |
| 109 | +signed commit |
| 110 | + |
| 111 | +signed commit message body |
| 112 | +---- |
| 113 | + |
| 114 | +== Mergetag signatures |
| 115 | + |
| 116 | +- created by: `git merge` on signed tag |
| 117 | +- payload/embedding: the whole signed tag object is embedded into |
| 118 | + the (merge) commit object as header entry `mergetag` |
| 119 | +- example: merge of the signed tag `signedtag` as above |
| 120 | + |
| 121 | +---- |
| 122 | +tree c7b1cff039a93f3600a1d18b82d26688668c7dea |
| 123 | +parent c33429be94b5f2d3ee9b0adad223f877f174b05d |
| 124 | +parent 04b871796dc0420f8e7561a895b52484b701d51a |
| 125 | +author A U Thor < [email protected]> 1465982009 +0000 |
| 126 | +committer C O Mitter < [email protected]> 1465982009 +0000 |
| 127 | +mergetag object 04b871796dc0420f8e7561a895b52484b701d51a |
| 128 | + type commit |
| 129 | + tag signedtag |
| 130 | + tagger C O Mitter < [email protected]> 1465981006 +0000 |
| 131 | + |
| 132 | + signed tag |
| 133 | + |
| 134 | + signed tag message body |
| 135 | + -----BEGIN PGP SIGNATURE----- |
| 136 | + Version: GnuPG v1 |
| 137 | + |
| 138 | + iQEcBAABAgAGBQJXYRhOAAoJEGEJLoW3InGJklkIAIcnhL7RwEb/+QeX9enkXhxn |
| 139 | + rxfdqrvWd1K80sl2TOt8Bg/NYwrUBw/RWJ+sg/hhHp4WtvE1HDGHlkEz3y11Lkuh |
| 140 | + 8tSxS3qKTxXUGozyPGuE90sJfExhZlW4knIQ1wt/yWqM+33E9pN4hzPqLwyrdods |
| 141 | + q8FWEqPPUbSJXoMbRPw04S5jrLtZSsUWbRYjmJCHzlhSfFWW4eFd37uquIaLUBS0 |
| 142 | + rkC3Jrx7420jkIpgFcTI2s60uhSQLzgcCwdA2ukSYIRnjg/zDkj8+3h/GaROJ72x |
| 143 | + lZyI6HWixKJkWw8lE9aAOD9TmTW9sFJwcVAzmAuFX2kUreDUKMZduGcoRYGpD7E= |
| 144 | + =jpXa |
| 145 | + -----END PGP SIGNATURE----- |
| 146 | + |
| 147 | +Merge tag 'signedtag' into downstream |
| 148 | + |
| 149 | +signed tag |
| 150 | + |
| 151 | +signed tag message body |
| 152 | + |
| 153 | +# gpg: Signature made Wed Jun 15 08:56:46 2016 UTC using RSA key ID B7227189 |
| 154 | +# gpg: Good signature from "Eris Discordia < [email protected]>" |
| 155 | +# gpg: WARNING: This key is not certified with a trusted signature! |
| 156 | +# gpg: There is no indication that the signature belongs to the owner. |
| 157 | +# Primary key fingerprint: D4BE 2231 1AD3 131E 5EDA 29A4 6109 2E85 B722 7189 |
| 158 | +---- |
| 159 | + |
| 160 | +- verify with: verification is embedded in merge commit message by default, |
| 161 | + alternatively with `git show --show-signature`: |
| 162 | + |
| 163 | +---- |
| 164 | +commit 9863f0c76ff78712b6800e199a46aa56afbcbd49 |
| 165 | +merged tag 'signedtag' |
| 166 | +gpg: Signature made Wed Jun 15 10:56:46 2016 CEST using RSA key ID B7227189 |
| 167 | +gpg: Good signature from "Eris Discordia < [email protected]>" |
| 168 | +gpg: WARNING: This key is not certified with a trusted signature! |
| 169 | +gpg: There is no indication that the signature belongs to the owner. |
| 170 | +Primary key fingerprint: D4BE 2231 1AD3 131E 5EDA 29A4 6109 2E85 B722 7189 |
| 171 | +Merge: c33429b 04b8717 |
| 172 | +Author: A U Thor < [email protected]> |
| 173 | +Date: Wed Jun 15 09:13:29 2016 +0000 |
| 174 | + |
| 175 | + Merge tag 'signedtag' into downstream |
| 176 | + |
| 177 | + signed tag |
| 178 | + |
| 179 | + signed tag message body |
| 180 | + |
| 181 | + # gpg: Signature made Wed Jun 15 08:56:46 2016 UTC using RSA key ID B7227189 |
| 182 | + # gpg: Good signature from "Eris Discordia < [email protected]>" |
| 183 | + # gpg: WARNING: This key is not certified with a trusted signature! |
| 184 | + # gpg: There is no indication that the signature belongs to the owner. |
| 185 | + # Primary key fingerprint: D4BE 2231 1AD3 131E 5EDA 29A4 6109 2E85 B722 7189 |
| 186 | +---- |
0 commit comments