gpg icon indicating copy to clipboard operation
gpg copied to clipboard

Updated keyScan to ignore trailing spaces in KEYINFO attributes

Open dovys opened this issue 7 years ago • 1 comments

Hey, I've recently ran into a rather odd issue where some keys have a trailing space at the end of the card ID:

> keyinfo --show-fpr --list --ssh-fpr
S KEYINFO 61D048F46EE1DCE... T D2760001240102010006064000390000  OPENPGP.3 - - MD5:9b:c8:3c:7b:44:... - -

This breaks key scanning as the scanner thinks there are 11 parts to it instead of 10. This change should be safe as gpg-agent returns a dash (-) when the value is actually empty.

dovys avatar Feb 12 '19 12:02 dovys

That's odd. However, looking at your code, wouldn't it be simpler to change this line

	parts := strings.Split(line, " ")

to this?

	parts := strings.Split(strings.TrimSpace(line), " ")

prep avatar Feb 17 '19 10:02 prep