Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] _gpg: Use explicit UIDs for public / secret keys.



On Tue, Jun 12, 2018 at 01:54:57PM +0300, Doron Behar wrote:
> Daniel,
> 
> I would like you to tell me how can I solve better the `fpr` thing.
> 
> To tell you the truth, I have no idea what `fpr` means. I just know, by
> comparing the output of `gpg --list-public-keys` with and without
> `--with-colons`, that the hexadecimal number afterwards is the actual
> key that needs to be used as an argument for these options. The way I
> understand it, only if there is an email address / description coming
> somewhere after the array element `fpr` (without another `fpr` in
> between), then this field is the description.
> 
> Please tell me, how can this algorithm get better? I've had one idea in
> mind: Perhaps we can perform a more strict pattern matchings test before
> adding a uid for example?

Not a gpg user, but it seems like the documentation for the format is at
https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob_plain;f=doc/DETAILS

With regards to better parsing, you might consider something like

local line
for line in "${(@f)secret_keys}"; do
  local parts=("${(@s,:,)line}")
  if [[ $parts[1] == fpr ]]; then
    ...

This way only the first column in a line is checked for fpr and the
correct column can be used for the other values.

- Matthew Martin



Messages sorted by: Reverse Date, Date, Thread, Author