X-Git-Url: https://git.sthu.org/?a=blobdiff_plain;f=gpgsigs%2Fgpgsigs;h=50505d24251bbb6c58f62c0a25af78dc41b38c4a;hb=66c2228f897a924e7d19a6bb4eb4e8e460c6e13d;hp=e27b33691561e3c40d7b305d87258feb6e11ec6f;hpb=c201de5e807680720bea0f506b2c48ca30707280;p=pgp-tools.git diff --git a/gpgsigs/gpgsigs b/gpgsigs/gpgsigs index e27b336..50505d2 100755 --- a/gpgsigs/gpgsigs +++ b/gpgsigs/gpgsigs @@ -181,7 +181,7 @@ while () { next if $uidstatus eq "r"; if ($latex and not $photocount) { # call once per key my ($shortkey) = substr $key, -8; - system "rm $shortkey.[1-9]*.eps"; + system "rm -f $shortkey.[1-9]*.eps"; system "gpg --photo-viewer 'gpgsigs-eps-helper $shortkey' --list-options show-photos --list-key $key > /dev/null"; $photocount = 1; } @@ -242,28 +242,37 @@ close MD; open MD, "gpg --with-colons --print-md sha256 $keytxt|" or warn "can't get gpg sha256\n"; my $SHA256 = ; close MD; +open MD, "gpg --with-colons --print-md ripemd160 $keytxt|" or warn "can't get gpg ripemd160\n"; +my $RIPEMD160 = ; +close MD; my @MD5 = split /:/, $MD5; my @SHA1 = split /:/, $SHA1; my @SHA256 = split /:/, $SHA256; +my @RIPEMD160 = split /:/, $RIPEMD160; $MD5 = $MD5[2]; $SHA1 = $SHA1[2]; $SHA256 = $SHA256[2]; +$RIPEMD160 = $RIPEMD160[2]; $MD5 =~ s/(.{16})/$1 /; $SHA1 =~ s/(.{20})/$1 /; $SHA256 =~ s/(.{32})/$1 /; +$RIPEMD160 =~ s/(.{20})/$1 /; $MD5 =~ s/([0-9A-Z]{2})/$1 /ig; $SHA1 =~ s/([0-9A-Z]{4})/$1 /ig; $SHA256 =~ s/([0-9A-Z]{4})/$1 /ig; +$RIPEMD160 =~ s/([0-9A-Z]{4})/$1 /ig; chomp $MD5; chomp $SHA1; chomp $SHA256; +chomp $RIPEMD160; my $metatxt = quotemeta($keytxt); $MD5 =~ s/^$metatxt:\s*//; $SHA1 =~ s/^$metatxt:\s*//; $SHA256 =~ s/^$metatxt:\s*//; +$RIPEMD160 =~ s/^$metatxt:\s*//; # write out result @@ -288,6 +297,7 @@ sub print_tag $key = undef; $uid = undef; my $line = 0; +my $keys = 0; print STDERR "Annotating $keytxt, writing into $outfile\n"; open (TXT, $keytxt) or die ("Cannot open $keytxt\n"); open (WRITE, '>'.$outfile) or die ("Cannot open $outfile for writing\n"); @@ -298,6 +308,7 @@ if ($latex) { \usepackage[margin=2cm]{geometry} \usepackage{alltt} \usepackage{graphicx} +\usepackage{grffile} \begin{document} \begin{alltt} EOF @@ -315,6 +326,22 @@ while () { if (/^SHA256 Checksum:/ && defined $SHA256) { s/[_[:xdigit:]][_ [:xdigit:]]+_/$SHA256/; } + if (/^RIPEMD160 Checksum:/ && defined $RIPEMD160) { + s/[_[:xdigit:]][_ [:xdigit:]]+_/$RIPEMD160/; + } + + if ( m/^[0-9]+\s+\[ \] Fingerprint OK/ ){ + if ($latex) { + if ($keys > 0) { + print WRITE "\\end{samepage}\n"; + } + print WRITE "\\begin{samepage}\n"; + ++$keys; + } + print WRITE; + next; + } + if ( m/^pub +(?:\d+)[DR]\/([0-9A-F]{8}) [0-9]{4}-[0-9]{2}-[0-9]{2} *(.*)/ ) { $key = $1; $uid = $2; @@ -342,7 +369,7 @@ while () { if ($latex and ($uid =~ /^\[jpeg image/)) { $photocount++; print WRITE "\\begin{flushright}\n"; - print WRITE "\\includegraphics[height=3cm]{$key.$photocount.eps}\n"; + print WRITE "\\includegraphics[height=3cm]{$key.$photocount}\n"; print WRITE "\\end{flushright}\n"; } } @@ -364,6 +391,10 @@ while () { print WRITE; } +if ($latex && ($keys > 0)) { + print WRITE "\\end{samepage}\n"; +} + print WRITE "Legend:\n"; my $num_myuids = 0; foreach my $i (0 .. @mykeys - 1) { @@ -404,8 +435,9 @@ B [I] II<[>B<,>IB<,>I<...>I<]>>I<]> F B was written to assist the user in signing keys during a keysigning party. It takes as input a file containing keys in C format and prepends every line with a tag indicating if the user has already signed -that uid. When the file contains C or C lines -and placeholders (C<__ __>), the checksum is inserted. +that uid. When the file contains C lines and placeholders +(C<__ __>), the checksum is inserted. ALGO can be set to the following algorithms: +MD5 SHA1 SHA256 or RIPEMD160. =head1 OPTIONS