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 719872 - Seahorse does not show fingerprint in key import dialog
Seahorse does not show fingerprint in key import dialog
Status: RESOLVED FIXED
Product: seahorse
Classification: Applications
Component: general
unspecified
Other Linux
: Normal major
: ---
Assigned To: Seahorse Maintainer
Seahorse Maintainer
Depends on:
Blocks:
 
 
Reported: 2013-12-04 22:43 UTC by itzeme
Modified: 2014-07-29 10:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Request the full fingerprint from the keyserver (3.32 KB, patch)
2014-04-09 23:35 UTC, Federico Mena Quintero
needs-work Details | Review
Pretty-print fingerprints in a smarter way (1.98 KB, patch)
2014-04-09 23:36 UTC, Federico Mena Quintero
committed Details | Review
Pretty-print the downloaded fingerprint (1.46 KB, patch)
2014-04-09 23:36 UTC, Federico Mena Quintero
accepted-commit_now Details | Review
Don't overwrite a potentially random character in the fingerprint (1.18 KB, patch)
2014-04-09 23:37 UTC, Federico Mena Quintero
committed Details | Review
When searching for keys, request the full fingerprint (3.34 KB, patch)
2014-07-29 09:17 UTC, Federico Mena Quintero
committed Details | Review
Prettify the downloaded fingerprint (1.40 KB, patch)
2014-07-29 09:18 UTC, Federico Mena Quintero
committed Details | Review

Description itzeme 2013-12-04 22:43:02 UTC
Using the seahorse option to find and import remote public keys, the properties dialog does not show the correct fingerprint but the key ID instead 


go to remote, find remote keys, selecting a key from the results and select properties in the context menu of the selected key


tested versions:
3.10.1 ArchLinux
3.2.2 Ubuntu 12.04.3
Comment 1 Federico Mena Quintero 2014-04-08 19:31:34 UTC
This happens because parse_hkp_index() only parses the fingerprint suffix from the lines that look like

  pub  2048R/1234ABCD 2010-01-22 John Doe <john@example.com>

i.e. it doesn't actually compute the fingerprint from an actual key.
Comment 2 Federico Mena Quintero 2014-04-08 19:47:55 UTC
I believe we can just pass a "fingerprint=on" variable to the GET request in seahorse_hkp_source_search_async(); that instructs the keyserver to return a full fingerprint for the found keys.

In turn, parse_hkp_index() will need to parse *that* full fingerprint instead of just picking up the 8 digits from the key ID.
Comment 3 Federico Mena Quintero 2014-04-09 23:35:12 UTC
Okay, here is a series of patches to fix this.
Comment 4 Federico Mena Quintero 2014-04-09 23:35:46 UTC
Created attachment 273943 [details] [review]
Request the full fingerprint from the keyserver
Comment 5 Federico Mena Quintero 2014-04-09 23:36:12 UTC
Created attachment 273944 [details] [review]
Pretty-print fingerprints in a smarter way
Comment 6 Federico Mena Quintero 2014-04-09 23:36:37 UTC
Created attachment 273945 [details] [review]
Pretty-print the downloaded fingerprint
Comment 7 Federico Mena Quintero 2014-04-09 23:37:02 UTC
Created attachment 273946 [details] [review]
Don't overwrite a potentially random character in the fingerprint
Comment 8 Stef Walter 2014-04-10 19:28:08 UTC
Review of attachment 273943 [details] [review]:

Cool. Thanks for working on fixing this.

::: pgp/seahorse-hkp-source.c
@@ +408,3 @@
+			char *str;
+
+			g_assert (subkey_with_id != NULL);

We shouldn't assert based on data received from outside the process. I think it would be better to just use subkey_with_id in the 'else if' condition above.
Comment 9 Stef Walter 2014-04-10 19:30:19 UTC
Review of attachment 273944 [details] [review]:

This looks good and makes sense.
Comment 10 Stef Walter 2014-04-10 19:31:09 UTC
Review of attachment 273945 [details] [review]:

Looks good, once the dependent patch is fixed up.
Comment 11 Stef Walter 2014-04-10 20:00:07 UTC
Review of attachment 273946 [details] [review]:

Thanks. looks good.
Comment 12 Federico Mena Quintero 2014-04-14 19:47:07 UTC
(In reply to comment #8)
> ::: pgp/seahorse-hkp-source.c
> @@ +408,3 @@
> +            char *str;
> +
> +            g_assert (subkey_with_id != NULL);
> 
> We shouldn't assert based on data received from outside the process. I think it
> would be better to just use subkey_with_id in the 'else if' condition above.

subkey_with_id gets initialized here:

	/* Add all the info to the key */
	subkey = seahorse_pgp_subkey_new ();
	seahorse_pgp_subkey_set_keyid (subkey, fpr);
	subkey_with_id = subkey;

In turn, subkey is always created as part of the initialization of a key.  So, subkey_with_id should not be null once we get past the stage of initializing the key - hence the assert.  It's mostly a sanity check against my own understanding of the code; I can remove it if you want.
Comment 13 Stef Walter 2014-04-15 14:54:25 UTC
(In reply to comment #12)
> (In reply to comment #8)
> > ::: pgp/seahorse-hkp-source.c
> > @@ +408,3 @@
> > +            char *str;
> > +
> > +            g_assert (subkey_with_id != NULL);
> > 
> > We shouldn't assert based on data received from outside the process. I think it
> > would be better to just use subkey_with_id in the 'else if' condition above.
> 
> subkey_with_id gets initialized here:
> 
>     /* Add all the info to the key */
>     subkey = seahorse_pgp_subkey_new ();
>     seahorse_pgp_subkey_set_keyid (subkey, fpr);
>     subkey_with_id = subkey;
> 
> In turn, subkey is always created as part of the initialization of a key.  So,
> subkey_with_id should not be null once we get past the stage of initializing
> the key - hence the assert.  It's mostly a sanity check against my own
> understanding of the code; I can remove it if you want.

I don't think we should g_assert() (and thus possibly abort() the process) based on input from outside the process. This would occur if a fingerprint came before a "pub " line.

Could you put a g_message() here about invalid input, then that would be better.
Comment 14 Federico Mena Quintero 2014-05-09 19:33:50 UTC
Woop, I didn't notice your reply :(  Will do that.
Comment 15 Federico Mena Quintero 2014-07-29 09:17:23 UTC
Created attachment 281924 [details] [review]
When searching for keys, request the full fingerprint

Updated patch without the g_assert()
Comment 16 Federico Mena Quintero 2014-07-29 09:18:09 UTC
Created attachment 281925 [details] [review]
Prettify the downloaded fingerprint

The other remaining patch, rebased against the previous one.
Comment 17 Stef Walter 2014-07-29 10:02:17 UTC
Thanks. Merged.