aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine-gpg.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2025-05-12 12:42:57 +0000
committerWerner Koch <[email protected]>2025-05-12 12:42:57 +0000
commit905bd760a99a455af6717b66311fc2197dea1055 (patch)
treed0044a74fa34dbfba6ef522cf27c03cca64bec67 /src/engine-gpg.c
parentChange timestamp fields from signed to unsigned long. (diff)
downloadgpgme-905bd760a99a455af6717b66311fc2197dea1055.tar.gz
gpgme-905bd760a99a455af6717b66311fc2197dea1055.zip
Add GPGME_CREATE_GROUP flag for gpgme_op_createkey and _createsubkey.
* src/gpgme.h.in (GPGME_CREATE_GROUP): New. * src/engine-gpg.c (gpg_add_algo_usage_expire): Pass to engine. * tests/run-genkey.c (parse_usage_string): Support here too.
Diffstat (limited to 'src/engine-gpg.c')
-rw-r--r--src/engine-gpg.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/engine-gpg.c b/src/engine-gpg.c
index eeb09c7b..e41fb69a 100644
--- a/src/engine-gpg.c
+++ b/src/engine-gpg.c
@@ -458,6 +458,27 @@ have_option_proc_all_sigs (engine_gpg_t gpg)
static int
+have_option_gen_group_key (engine_gpg_t gpg)
+{
+ static unsigned int flag;
+
+ if (flag)
+ ;
+ else if (have_gpg_version (gpg, "2.5.7"))
+ flag = 1|2;
+ else if (have_gpg_version (gpg, "2.4.8") && !have_gpg_version (gpg, "2.5.0"))
+ flag = 1|2;
+ else if (have_gpg_version (gpg, "2.2.48") && !have_gpg_version (gpg, "2.3.0"))
+ flag = 1|2;
+ else
+ flag = 1;
+
+ return !!(flag & 2);
+}
+
+
+
+static int
have_cmd_modify_recipients (engine_gpg_t gpg)
{
static unsigned int flag;
@@ -2873,12 +2894,14 @@ gpg_add_algo_usage_expire (engine_gpg_t gpg,
err = add_arg (gpg, algo? algo : "default");
if (!err)
{
- char tmpbuf[5*4+1];
- snprintf (tmpbuf, sizeof tmpbuf, "%s%s%s%s",
+ char tmpbuf[6*5+1];
+ snprintf (tmpbuf, sizeof tmpbuf, "%s%s%s%s%s",
(flags & GPGME_CREATE_SIGN)? " sign":"",
(flags & GPGME_CREATE_ENCR)? " encr":"",
(flags & GPGME_CREATE_CERT)? " cert":"",
- (flags & GPGME_CREATE_AUTH)? " auth":"");
+ (flags & GPGME_CREATE_AUTH)? " auth":"",
+ ((flags & GPGME_CREATE_GROUP)
+ && have_option_gen_group_key (gpg))? " group":"");
err = add_arg (gpg, *tmpbuf? tmpbuf : "default");
}
if (!err)