Walt Mankowski on Thu, 3 Jul 2003 22:36:06 -0400 |
On Wed, Jul 02, 2003 at 06:41:37PM -0400, Jeff Abrahamson wrote: > Do you ever find yourself wondering whose key you've signed at a plug > meeting? Should I verify your info? But maybe I already signed your > key last year and I forgot. Verifying again would be such a waste. > > Or maybe this is just me: I'm so bad with names. But not anymore. Here > are two bash functions that tell me whose keys I've signed: > > signed-me-verbose() { gpg --list-sigs | \ > egrep '(^pub|jeff@purple.com)'| \ > perl -wne 'my $last_line = ""; while(my $line = <>) { \ > if($line !~ /^pub/) { print $last_line; print $line; } \ > $last_line = $line; }'; } > > signed-me() { gpg --list-sigs | \ > egrep '(^pub|jeff@purple.com)'| \ > perl -wne 'my $last_line = ""; while(my $line = <>) { \ > if($line !~ /^pub/ and $last_line =~ /^pub/) { print $last_line; } \ > $last_line = $line; }'; } gpg --list-sigs takes forever on my box. Here's a one-liner (FSVO "one" :) that has slightly different output format, but runs in just a few seconds on my box: gpg --fast-list-mode --with-colons --list-sigs |egrep '(^pub|5DF19E2B67A7B584)'| perl -ne 'if($_ !~ /^pub/ and $last_line =~ /^pub/) { print $last_line;} $last_line = $_;' | cut -d: -f5 | xargs gpg --list-keys |grep '^pub' It uses --fast-list-mode, which speeds things up considerably because it leaves out a lot of the information, particularly the names. I get the names back by running gpg --list-keys on the output. It also uses --with-colons, which prints out the data in a format that's easier and more reliable to parse. --with-colons prints out the long form of the key id, which is the last 16 hex digits of the fingerprint instead of the last 8 as are more commonly used. That's my key id in there for test purposes; you'd need to plug your own in, or have that be a parameter in a shell script or bash function or whatever. David -- if you're following this, any chance of something like this being a built-in option in a future version of gpg? Walt Attachment:
pgpZlYnaezBXx.pgp
|
|