This commit allows git to create and check x509 type signatures using gpgsm. Signed-off-by: Henning Schild <henning.schild@xxxxxxxxxxx> --- Documentation/config.txt | 2 +- gpg-interface.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index c0bd80954..b6f9b47d5 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -1830,7 +1830,7 @@ gpg.program:: gpg.format:: Specifies which key format to use when signing with `--gpg-sign`. - Default is "openpgp", that is also the only supported value. + Default is "opengpg" and another possible value is "x509". gpg.<format>.program:: Use this to customize the program used for the signing format you diff --git a/gpg-interface.c b/gpg-interface.c index 65098430f..bf8d567a4 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -16,13 +16,18 @@ struct gpg_format_data { #define PGP_SIGNATURE "-----BEGIN PGP SIGNATURE-----" #define PGP_MESSAGE "-----BEGIN PGP MESSAGE-----" +#define X509_SIGNATURE "-----BEGIN SIGNED MESSAGE-----" -enum gpgformats { PGP_FMT }; +enum gpgformats { PGP_FMT, X509_FMT }; struct gpg_format_data gpg_formats[] = { { .format = "openpgp", .program = "gpg", .extra_args_verify = { "--keyid-format=long" }, .sigs = { PGP_SIGNATURE, PGP_MESSAGE } }, + { .format = "x509", .program = "gpgsm", + .extra_args_verify = { NULL }, + .sigs = { X509_SIGNATURE, NULL } + }, }; static const char *gpg_format = "openpgp"; @@ -182,6 +187,9 @@ int git_gpg_config(const char *var, const char *value, void *cb) if (!strcmp(var, "gpg.program") || !strcmp(var, "gpg.openpgp.program")) return git_config_string(&gpg_formats[PGP_FMT].program, var, value); + if (!strcmp(var, "gpg.x509.program")) + return git_config_string(&gpg_formats[X509_FMT].program, var, + value); return 0; } -- 2.16.4