gpg
gpg copied to clipboard
Updated keyScan to ignore trailing spaces in KEYINFO attributes
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.
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), " ")