Re: Signing as one member of a set of keys
Here are the perl scripts I cobbled together to put the ring signature at the end of the file, after a separator. I called the executable program from the earlier C source code "ringsig". I call these ringver and ringsign. I'm no perl hacker so these could undoubtedly be greatly improved. ringver === #! /usr/bin/perl # Usage: $0 pubkeyfile < filetoverify die("Usage: ringver pubkeyfile < filetoverify") if @ARGV != 1; $outfile = "/tmp/sigdata$$"; $sigfile = "/tmp/sigfile$$"; $separator = " \\+\\+multisig v1\\.0"; $pubfile=$ARGV[0]; -r $pubfile || die ("Error reading $pubfile"); open (OUTFILE, ">".$outfile) || die ("Unable to open $outfile for output"); open (SIGFILE, ">".$sigfile) || die ("Unable to open $sigfile for output"); # Skip leading blank lines on input file $_=<STDIN> while /^$/; # Save lines to outfile until separator print OUTFILE $_; while (<STDIN>) { last if /$separator/; print OUTFILE $_; } die ("No signature found in input file") if !$_; # Save remaining lines ot sigfile print SIGFILE while <STDIN>; close INFILE; close OUTFILE; close SIGFILE; open (SIG, "./ringsig -v $outfile $pubfile < $sigfile |") || die ("Error running verify program"); # Print output from program print while <SIG>; close SIG; unlink($sigfile); unlink($outfile); exit($?); ringsign === #! /usr/bin/perl # Usage: $0 filetosign pubkeyfile privkeyfile die("Usage: ringsign filetosign pubkeyfile privkeyfile > outfile") if @ARGV < 3; $outfile = "/tmp/sigdata$$"; $separator = " ++multisig v1.0"; open(INFILE, $ARGV[0]) || die ("Unable to open $ARGV[0] for input"); $pubfile=$ARGV[1]; $secfile=$ARGV[2]; -r $pubfile || die ("Error reading $pubfile"); -r $secfile || die ("Error reading $secfile"); open (OUTFILE, ">".$outfile) || die ("Unable to open $outfile for output"); # Skip leading blank lines on input file $_=<INFILE> while /^$/; # Save lines to outfile print OUTFILE $_; print OUTFILE $_ while <INFILE>; close INFILE; close OUTFILE; # Re-open infile open(INFILE, $ARGV[0]) || die ("Unable to open $ARGV[0] for input"); open (SIG, "./ringsig -s $outfile $pubfile $secfile|") || die ("Error signing"); @sigs = <SIG>; close SIG; die ("Error from signature program") if ($?); # Output infile, separator, sig print while <INFILE>; print $separator . "\n"; print @sigs; unlink($outfile);
participants (1)
-
Anonymous User