[Pgp-tools-commit] r889 - in trunk: debian gpgsigs

Guilhem Moulin guilhem-guest at moszumanska.debian.org
Wed Feb 1 18:50:51 UTC 2017


Author: guilhem-guest
Date: 2017-02-01 18:50:51 +0000 (Wed, 01 Feb 2017)
New Revision: 889

Modified:
   trunk/debian/changelog
   trunk/gpgsigs/gpgsigs
Log:
gpgsigs: allow digest hexadecimal characters to replace multiple '_' in the fill-in forms.

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2017-01-31 19:13:03 UTC (rev 888)
+++ trunk/debian/changelog	2017-02-01 18:50:51 UTC (rev 889)
@@ -3,6 +3,9 @@
   * gpgsigs:
     + Skip undefined UIDs.
     + Properly handle (skip) unknown attributes.
+    + Allow digest hexadecimal characters to replace multiple '_' in the
+      fill-in forms.  (This is not what gpgparticipants(1) produces, but some
+      KSP organizers use other scripts.)
 
  -- Guilhem Moulin <guilhem at guilhem.org>  Tue, 31 Jan 2017 17:32:58 +0100
 

Modified: trunk/gpgsigs/gpgsigs
===================================================================
--- trunk/gpgsigs/gpgsigs	2017-01-31 19:13:03 UTC (rev 888)
+++ trunk/gpgsigs/gpgsigs	2017-02-01 18:50:51 UTC (rev 889)
@@ -391,7 +391,8 @@
 while (<TXT>) {
 	$line++;
 	if (/^(\S+) Checksum:/) {
-		my $md = getChecksum(uc $1, $keytxt);
+		my $algo = uc $1;
+		my $md = getChecksum($algo, $keytxt);
 		if ($md) {
 			my $r = $_;
 			while ( /^(?:.*_)?$/ ) {
@@ -399,8 +400,16 @@
 				$_ = <TXT>;
 				$r .= $_;
 			}
-			$r =~ s/_/%c/g;
-			print WRITE sprintf ($r, unpack ("C*", $md));
+			my $n = $r =~ y/_//;
+			my $k = $n / length($md);
+			if ($k * length($md) != $n) {
+				warn "Skipping $algo digest value (invalid fill-in length)\n";
+			} else {
+				my $w = '_' x $k;
+				$r =~ s/\Q$w\E/%c/g;
+				$r = sprintf($r, unpack ("C*", $md));
+			}
+			print WRITE $r;
 			next;
 		}
 	}




More information about the Pgp-tools-commit mailing list