From 39b3fae5085bf674215b46c48fbf78cbe1d55f08 Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Mon, 15 Mar 2021 08:20:50 -0600 Subject: [PATCH] Print Fingerprint for each identity. Orig from jrick. --- main.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index cb39d91..e590e69 100644 --- a/main.go +++ b/main.go @@ -8,6 +8,7 @@ import ( "io/ioutil" "os" "path/filepath" + "text/tabwriter" "golang.org/x/crypto/openpgp" "golang.org/x/crypto/openpgp/clearsign" @@ -66,6 +67,15 @@ func main() { os.Exit(1) } + if flags.sig == "" && flags.file == "" { + for _, ent := range kr { + for name := range ent.Identities { + fmt.Printf("%q (%X)\n", name, ent.PrimaryKey.Fingerprint) + } + } + return + } + var sig, message io.Reader var clearsigBlock *clearsign.Block var armored bool @@ -115,8 +125,10 @@ func main() { } errExit(err) + w := tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', 0) for _, id := range ent.Identities { - fmt.Printf("%q\n", id.Name) + fmt.Fprintf(w, "%q\t(%X)\n", id.Name, ent.PrimaryKey.Fingerprint) } + w.Flush() fmt.Println("Signature OK.") }