summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2023-03-08 10:50:15 +0100
committerWerner Koch <wk@gnupg.org>2023-03-08 10:50:15 +0100
commit76351c4877d60799a35afccd87037d5dd0871262 (patch)
tree61ecd4ff7fd262c9a47a716b0b8b6fe7549c5688
parent73e46b34658c0130de5ab9e3f4ce1ac4ee35c5e2 (diff)
downloadgpgme-76351c4877d60799a35afccd87037d5dd0871262.tar.gz
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.
-rw-r--r--tests/run-verify.c8
1 files changed, 8 insertions, 0 deletions
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);