diff options
author | Andre Heinecke <[email protected]> | 2019-06-05 15:23:59 +0000 |
---|---|---|
committer | Andre Heinecke <[email protected]> | 2019-06-05 15:23:59 +0000 |
commit | 024a7f75d4b8e017b92a13552b23e7fb1d22a5ce (patch) | |
tree | 17bbced244558c832d206a8b58712eb7abe8f64f /tests/run-threaded.c | |
parent | core: Prettify _gpgme_io_select debug output again and fix TRACE_SYSRES. (diff) | |
download | gpgme-024a7f75d4b8e017b92a13552b23e7fb1d22a5ce.tar.gz gpgme-024a7f75d4b8e017b92a13552b23e7fb1d22a5ce.zip |
tests: Implement import in run-threaded
* tests/run-threaded.c (import): New.
(do_data_op): Call it.
Diffstat (limited to 'tests/run-threaded.c')
-rw-r--r-- | tests/run-threaded.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/run-threaded.c b/tests/run-threaded.c index 8a1c666e..fef24cb0 100644 --- a/tests/run-threaded.c +++ b/tests/run-threaded.c @@ -453,6 +453,32 @@ decrypt (const char *fname, gpgme_protocol_t proto) random_data_close (data); } +void +import (const char *fname, gpgme_protocol_t proto) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + data_t data = random_data_new (fname); + + log ("Starting import on: %s", fname); + + err = gpgme_new (&ctx); + fail_if_err (err); + + err = gpgme_set_protocol (ctx, proto); + fail_if_err (err); + + gpgme_set_offline (ctx, 1); + + err = gpgme_op_import (ctx, data->dh); + fail_if_err (err); + + gpgme_release (ctx); + + log ("Import completed."); + + random_data_close (data); +} static THREAD_RET do_data_op (void *file_name) @@ -502,6 +528,16 @@ do_data_op (void *file_name) decrypt (fname, GPGME_PROTOCOL_CMS); break; } + case GPGME_DATA_TYPE_PGP_KEY: + { + import (fname, GPGME_PROTOCOL_OpenPGP); + break; + } + case GPGME_DATA_TYPE_X509_CERT: + { + import (fname, GPGME_PROTOCOL_CMS); + break; + } default: { out ("Unhandled data type 0x%x for '%s'\n", type, fname); |