[seahorse] Add support for GnuPG DSA2 keys



commit 05d133f818b574fab1a36a8f71ae14993e20e26c
Author: nobled <nobled dreamwidth org>
Date:   Sat Oct 10 01:31:37 2009 -0400

    Add support for GnuPG DSA2 keys
    
    Newer versions of GPG have support for 3072-bit DSA keys
    turned on by default. This tests for supported GPG versions
    at compile-time with the new macro GPG_MICRO.
    
    Closes: bgo#594707
    
    Signed-off-by: Stef Walter <stef memberwebs com>

 pgp/seahorse-gpgme-key-op.c |    2 +-
 pgp/seahorse-gpgme-key-op.h |   12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/pgp/seahorse-gpgme-key-op.c b/pgp/seahorse-gpgme-key-op.c
index c059494..f45c5de 100644
--- a/pgp/seahorse-gpgme-key-op.c
+++ b/pgp/seahorse-gpgme-key-op.c
@@ -144,7 +144,7 @@ seahorse_gpgme_key_op_generate (SeahorseGpgmeSource *psrc, const gchar *name,
     /* Subkey xml */
     if (type == DSA_ELGAMAL)
         parms = g_strdup_printf ("%s%d\nSubkey-Type: ELG-E\nSubkey-Length: %d\n%s",
-                                 start, DSA_MAX, length, common);
+                                 start, (length < DSA_MAX) ? length : DSA_MAX, length, common);
     else
         parms = g_strdup_printf ("%s%d\n%s", start, length, common);
 
diff --git a/pgp/seahorse-gpgme-key-op.h b/pgp/seahorse-gpgme-key-op.h
index 5d67a3d..f2c434e 100644
--- a/pgp/seahorse-gpgme-key-op.h
+++ b/pgp/seahorse-gpgme-key-op.h
@@ -42,9 +42,10 @@
     ( GPG_MAJOR == 1 && ( GPG_MINOR <  4 || GPG_MICRO < 10 ) )
 
 typedef enum {
-	/* DSA key with ElGamal subkey. The DSA key will have length of 1024,
-	 * while the ElGamal length is variable within #ELGAMAL_MIN and
-	 * #LENGTH_MAX. Only used in seahorse_ops_key_generate().
+	/* DSA key with ElGamal subkey. The ElGamal length is variable
+	 * within #ELGAMAL_MIN and #LENGTH_MAX. The DSA key will have a
+	 * length equal to the ElGamal key's up to a limit of #DSA_MAX.
+	 * Only used in seahorse_ops_key_generate().
 	 */
 	DSA_ELGAMAL = 1,
 	/* DSA key, sign only. Can be a subkey or a primary key.
@@ -83,7 +84,12 @@ typedef enum {
 	/* Minimum length for #DSA. */
 	DSA_MIN = 768,
 	/* Maximum length for #DSA. */
+#if ( GPG_MAJOR == 2 &&   GPG_MINOR == 0 && GPG_MICRO < 12 ) || \
+    ( GPG_MAJOR == 1 && ( GPG_MINOR <  4 || GPG_MICRO < 10 ) )
 	DSA_MAX = 1024,
+#else
+	DSA_MAX = 3072,
+#endif
 	/* Minimum length for #ELGAMAL. Maximum length is #LENGTH_MAX. */
 	ELGAMAL_MIN = 768,
 	/* Minimum length of #RSA_SIGN and #RSA_ENCRYPT. Maximum length is



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]