core: add experimental GPGME_EXPORT_MODE_NOUID.

* src/gpgme.h.in (GPGME_EXPORT_MODE_NOUID): New.
* src/export.c (export_start): Adjust option check.
* src/engine-gpg.c (export_common): Implement option.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2018-10-02 11:18:00 +02:00
parent 76bdfabb05
commit 7b861945fd
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
4 changed files with 14 additions and 1 deletions

View File

@ -4663,6 +4663,10 @@ If this flag is used with @code{GPGME_EXPORT_MODE_SECRET} for an X.509
key the export format will be changed to PKCS#12 which also includes
the certificate. This flag may not be used with OpenPGP.
@item GPGME_EXPORT_MODE_NOUID
@since{1.12.0 - experimental}
Do not export user ids. Works only with certain gpg version.
@end table

View File

@ -2241,7 +2241,14 @@ export_common (engine_gpg_t gpg, gpgme_export_mode_t mode,
return gpg_error (GPG_ERR_NOT_SUPPORTED);
if ((mode & GPGME_EXPORT_MODE_MINIMAL))
{
if ((mode & GPGME_EXPORT_MODE_NOUID))
err = add_arg (gpg, "--export-options=export-minimal,export-drop-uids");
else
err = add_arg (gpg, "--export-options=export-minimal");
}
else if ((mode & GPGME_EXPORT_MODE_NOUID))
err = add_arg (gpg, "--export-options=export-drop-uids");
if (err)
;

View File

@ -123,6 +123,7 @@ export_start (gpgme_ctx_t ctx, int synchronous, const char *pattern,
|GPGME_EXPORT_MODE_MINIMAL
|GPGME_EXPORT_MODE_SECRET
|GPGME_EXPORT_MODE_RAW
|GPGME_EXPORT_MODE_NOUID
|GPGME_EXPORT_MODE_PKCS12)))
return gpg_error (GPG_ERR_INV_VALUE); /* Invalid flags in MODE. */

View File

@ -405,6 +405,7 @@ gpgme_pinentry_mode_t;
#define GPGME_EXPORT_MODE_SECRET 16
#define GPGME_EXPORT_MODE_RAW 32
#define GPGME_EXPORT_MODE_PKCS12 64
#define GPGME_EXPORT_MODE_NOUID 128
typedef unsigned int gpgme_export_mode_t;