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);