From 76351c4877d60799a35afccd87037d5dd0871262 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 8 Mar 2023 10:50:15 +0100 Subject: [PATCH] tests: Add option --binary to run-verify * tests/run-verify.c (main): Set encoding. -- gpgsm usually used autodetection of the input format. But sometimes it is required to tell gpgsm that the input is binary encoded. In particular, this allows to strip trailing zeroes from a detached signature. --- tests/run-verify.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/run-verify.c b/tests/run-verify.c index 831c4614..8a400589 100644 --- a/tests/run-verify.c +++ b/tests/run-verify.c @@ -231,6 +231,7 @@ show_usage (int ex) " --status print status lines from the backend\n" " --openpgp use the OpenPGP protocol (default)\n" " --cms use the CMS protocol\n" + " --binary assume binary signature\n" " --sender MBOX use MBOX as sender address\n" " --repeat N repeat the operation N times\n" " --auto-key-retrieve\n" @@ -255,6 +256,7 @@ main (int argc, char **argv) const char *directory = NULL; int auto_key_retrieve = 0; int auto_key_import = 0; + gpgme_data_encoding_t encoding = GPGME_DATA_ENCODING_NONE; int diagnostics = 0; int repeats = 1; int i; @@ -292,6 +294,11 @@ main (int argc, char **argv) protocol = GPGME_PROTOCOL_CMS; argc--; argv++; } + else if (!strcmp (*argv, "--binary")) + { + encoding = GPGME_DATA_ENCODING_BINARY; + argc--; argv++; + } else if (!strcmp (*argv, "--sender")) { argc--; argv++; @@ -429,6 +436,7 @@ main (int argc, char **argv) gpgme_strerror (err)); exit (1); } + gpgme_data_set_encoding (sig, encoding); if (fp_msg) { err = gpgme_data_new_from_stream (&msg, fp_msg);