[seahorse] gpgme: Allow empty passphrase on key creation
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse] gpgme: Allow empty passphrase on key creation
- Date: Mon, 11 Jan 2021 23:05:25 +0000 (UTC)
commit afc535ce3f0a9f7f5eb0f3c341dbd0566bca09a4
Author: Jeremias Ortega <jeremias ortega tech>
Date: Sun Dec 13 17:35:23 2020 -0600
gpgme: Allow empty passphrase on key creation
Fixes https://gitlab.gnome.org/GNOME/seahorse/-/issues/161
pgp/seahorse-gpgme-key-op.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/pgp/seahorse-gpgme-key-op.c b/pgp/seahorse-gpgme-key-op.c
index 1960ec39..1d3df151 100644
--- a/pgp/seahorse-gpgme-key-op.c
+++ b/pgp/seahorse-gpgme-key-op.c
@@ -122,7 +122,6 @@ seahorse_gpgme_key_op_generate_async (SeahorseGpgmeKeyring *keyring,
g_return_if_fail (SEAHORSE_IS_GPGME_KEYRING (keyring));
g_return_if_fail (name);
g_return_if_fail (strlen (name) > 4);
- g_return_if_fail (passphrase);
/* Check lengths for each type */
switch (type) {
@@ -147,8 +146,14 @@ seahorse_gpgme_key_op_generate_async (SeahorseGpgmeKeyring *keyring,
expires_date = g_strdup ("0");
/* Common xml */
- common = g_strdup_printf ("Name-Real: %s\nExpire-Date: %s\nPassphrase: %s\n"
- "</GnupgKeyParms>", name, expires_date, passphrase);
+ common = g_strdup_printf ("Name-Real: %s\nExpire-Date: %s\n"
+ "</GnupgKeyParms>", name, expires_date);
+
+ if (passphrase != NULL && strlen (passphrase) > 0)
+ common = g_strdup_printf ("Passphrase: %s\n%s", passphrase, common);
+ else
+ common = g_strdup_printf ("%%no-protection\n%s", common);
+
if (email != NULL && strlen (email) > 0)
common = g_strdup_printf ("Name-Email: %s\n%s", email, common);
if (comment != NULL && strlen (comment) > 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]