summaryrefslogtreecommitdiff
path: root/security/gpg2dot
diff options
context:
space:
mode:
authorlukem <lukem@pkgsrc.org>2004-01-21 04:14:45 +0000
committerlukem <lukem@pkgsrc.org>2004-01-21 04:14:45 +0000
commit6d77a64959b2aff89431eac92cafe3ba0fcf5488 (patch)
tree08eece094656a6f597cca4f5b0b358e09441ab76 /security/gpg2dot
parent39ecc311a5019efa033e9dd9aa9478cffb970e64 (diff)
downloadpkgsrc-6d77a64959b2aff89431eac92cafe3ba0fcf5488.tar.gz
"Collapse" mutual trust into a single line of a different color.
If an optional "mykeyid" is given on the command line, use different colors for lines to & from that node. The colors are: green mutual trust, includes mykey blue mutual trust, not mykey orange someone trusts mykey (one way) red mykey trusts someone (one way) black one way trust, not mykey
Diffstat (limited to 'security/gpg2dot')
-rw-r--r--security/gpg2dot/files/gpg2dot.pl47
1 files changed, 37 insertions, 10 deletions
diff --git a/security/gpg2dot/files/gpg2dot.pl b/security/gpg2dot/files/gpg2dot.pl
index 6cd62881c52..174cb8581e0 100644
--- a/security/gpg2dot/files/gpg2dot.pl
+++ b/security/gpg2dot/files/gpg2dot.pl
@@ -1,15 +1,24 @@
#!@PREFIX@/bin/perl
+#
+# $NetBSD: gpg2dot.pl,v 1.2 2004/01/21 04:14:45 lukem Exp $
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
-# <atatat@NetBSD.ORG> wrote this file. As long as you retain this notice you
-# can do whatever you want with this stuff. If we meet some day, and you think
-# this stuff is worth it, you can buy me a beer in return.
-#
-# Andrew Brown
+# Andrew Brown <atatat@NetBSD.org> and Luke Mewburn <lukem@NetBSD.org>
+# wrote this file. As long as you retain this notice you can do whatever
+# you want with this stuff. If we meet some day, and you think this stuff
+# is worth it, you can buy us a beer in return.
# ----------------------------------------------------------------------------
+#
+# gpg2dot [mykey] --
+# generate input for dot(1) from gpg(1) --list-sigs
+# gpg http://www.gnupg.org
+# dot http://www.graphviz.org/
+#
+
$date = localtime();
+$mykeyid = shift;
$sg = "";
open(GPG, "gpg --list-keys --verbose 2>/dev/null |");
@@ -25,24 +34,42 @@ while (<GPG>) {
}
$kuid =~ s/\"/\\\"/g;
($keyid = $lkeyid) =~ s:.*/::;
- next if ($kuid !~ /netbsd.org/i);
$kuid{$keyid} = $kuid;
+ next if ($label{$keyid} != "");
$label{$keyid} = "$lkeyid - $date\\n$kuid";
}
elsif (/^sig (.{7}) (\S+)\s+(\S+)\s+(.+\S)/) {
($skeyid, $date, $suid) = ($2, $3, $4);
- next if ($kuid !~ /netbsd.org/i ||
- $suid =~ /id not found/ ||
+ next if ($suid =~ /id not found/ ||
$skeyid eq $keyid);
push(@isigs, "$keyid $skeyid $date $suid");
+ $sigmap{"$keyid-$skeyid"} = 1;
}
}
foreach (@isigs) {
($keyid, $skeyid, $date, $suid) = split(/ /, $_, 4);
next if (!$kuid{$keyid} || !$kuid{$skeyid});
- push(@sigs, sprintf("\"%s\" -> \"%s\";\t// %s -> %s\n",
- $skeyid, $keyid, $kuid{$skeyid}, $kuid{$keyid}));
+ next if ($sigmap{"$skeyid-$keyid"} == -1);
+ $color = "black";
+ $attrs = "";
+ if ($sigmap{"$skeyid-$keyid"}) {
+ if ($keyid eq $mykeyid ||
+ $skeyid eq $mykeyid) { # two way trust, includes me
+ $color = "green";
+ } else { # two way trust, me unevolved
+ $color = "blue";
+ }
+ $attrs = ",dir=\"both\"";
+ $sigmap{"$keyid-$skeyid"} = -1;
+ } elsif ($keyid eq $mykeyid) { # you trust me (one way)
+ $color = "orange";
+ } elsif ($skeyid eq $mykeyid) { # i trust you (one way)
+ $color = "red";
+ }
+ push(@sigs, sprintf("\"%s\" -> \"%s\" [color=\"%s\"%s];\t// %s -> %s\n",
+ $skeyid, $keyid, $color, $attrs,
+ $kuid{$skeyid}, $kuid{$keyid}));
$signer{$skeyid} = "yes";
$signed{$keyid} = "yes";
}