After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 555205 - creates all-capable PGP keys when it should create Sign-Only keys
creates all-capable PGP keys when it should create Sign-Only keys
Status: RESOLVED FIXED
Product: seahorse
Classification: Applications
Component: general
2.22.x
Other Linux
: Normal normal
: 2.26.0
Assigned To: Seahorse Maintainer
Seahorse Maintainer
: 539532 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2008-10-06 10:45 UTC by Josselin Mouette
Modified: 2009-10-11 01:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Adds "Key-Usage: sign" line to --batch standard input (599 bytes, patch)
2009-09-05 21:15 UTC, nobled
none Details | Review
Add "Key-Usage:" and "Subkey-Usage:" lines to --batch input (994 bytes, patch)
2009-09-06 14:44 UTC, nobled
none Details | Review
Add Key-Usage flags to new keys (1.47 KB, patch)
2009-09-10 04:29 UTC, nobled
none Details | Review
Updated patch that applies to master (1.53 KB, patch)
2009-10-10 20:34 UTC, nobled
none Details | Review

Description Josselin Mouette 2008-10-06 10:45:42 UTC
[ forwarded from http://bugs.debian.org/501085 by Daniel Kahn Gilmor ]

When creating a new OpenPGP key, seahorse sets all capabilities on the
key (Encrypt, Certify, Sign, Authenticate) even though it claims to
create Sign-Only keys.

To reproduce from a bare account:

 * launch seahorse
 *  Key | Create New Key | PGP Key
 * enter bogus name/address/comment data (i've been using:
    "Test User (DO NOT USE!!!) <test@example.org>")
 * expand "Advanced Key Options"
 * set "Encryption Type" to "RSA (sign-only)"
 * choose a password.
 * examine the flags of the resulting keys:

   gpg --with-colons --fixed-list-mode --list-keys 'Test User' | grep '^pub:' | cut -f12 -d:

If the key was really "sign-only", the output should be marked either
"sS" (Sign) or "scSC" (Sign and Certify).

instead, i get "escaESCA" from the above output.

This is bad, because it makes it difficult for users to separate the
various capabilities across keys and subkeys.  Keeping capabilities
separated between keys is a useful "defense in layers" technique which
allows users to rotate subkeys at different intervals, and to transfer
more-sensitive keys into more secure storage.
Comment 1 Adam Schreiber 2008-12-11 23:41:03 UTC
*** Bug 539532 has been marked as a duplicate of this bug. ***
Comment 2 nobled 2009-09-05 21:15:14 UTC
Created attachment 142563 [details] [review]
Adds "Key-Usage: sign" line to --batch standard input

It took some digging [1], but this is actually really simple to fix-- this patch makes sure Seahorse sends the line "Key-Usage: sign" to GnuPG when batch-generating a new key. Because without that, GnuPG defaults to adding usage flags for all RSA's capabilities, even though it's REALLY recommended not to use the same RSA key for encryption and signing, for security reasons.

[1] http://lists.gnupg.org/pipermail/gnupg-users/2007-February/030330.html
Comment 3 nobled 2009-09-06 14:44:26 UTC
Created attachment 142597 [details] [review]
Add "Key-Usage:" and "Subkey-Usage:" lines to --batch input
Comment 4 nobled 2009-09-10 04:29:52 UTC
Created attachment 142850 [details] [review]
Add Key-Usage flags to new keys

(Right, forgot to format it with the git commit message)
Comment 5 Stef Walter 2009-10-10 03:09:23 UTC
Does this patch work with GnuPG versions prior to 1.4.10? Or is "Key-Usage: sign" a new 1.4.10/2.0.12 feature that would break on earlier versions?
Comment 6 nobled 2009-10-10 04:03:56 UTC
It's definitely not that new-- it's mentioned in gpg-1.4.6's /doc/DETAILS at least. I think it's always been a part of that XML format.
Comment 7 Stef Walter 2009-10-10 20:01:50 UTC
Cool. I checked doc/DETAILS in gnupg 1.2.0 as well, and these fields are there. This patch no longer applies. Other than that, looks good to go in.
Comment 8 nobled 2009-10-10 20:34:27 UTC
Created attachment 145224 [details] [review]
Updated patch that applies to master

This one should work again.
Comment 9 Stef Walter 2009-10-11 01:03:55 UTC
Thanks nobled. Committed. Tested by generating a 'RSA (sign only)' key. Josselin, could you test this as well, to make sure it fixes the bug for you. 

commit 9065861cdb314a6351fe241145c73436f9252a8f
Author: nobled <nobled@dreamwidth.org>
Date:   Sat Oct 10 16:27:24 2009 -0400

    Set usage flags during unattended key generation
    
    Add lines for "Key-Usage:" and "Subkey-Usage:" to the standard input
    to `gpg --batch --gen-key`, as documented in GnuPG's doc/DETAILS.
    
    Closes: bgo#555205