security/nss/cmd/signver/examples/1/signedForm.pl

Wed, 31 Dec 2014 07:53:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:53:36 +0100
branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
permissions
-rwxr-xr-x

Correct small whitespace inconsistency, lost while renaming variables.

     1 #! /usr/bin/perl
     2 # This Source Code Form is subject to the terms of the Mozilla Public
     3 # License, v. 2.0. If a copy of the MPL was not distributed with this
     4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
     8 sub decode {
     9     read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
    10     @pairs = split(/&/, $buffer);
    11     foreach $pair (@pairs)
    12     {
    13         ($name, $value) = split(/=/, $pair);
    14         $value =~tr/+/ /;
    15         $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    16         $FORM{$name} = $value;
    17 #        print "name=$name  value=$value<BR>\n";
    18     }
    19 }
    21 print "Content-type: text/html\n\n";
    23 &decode();
    25 $dataSignature = $FORM{'dataSignature'};
    26 $dataToSign = $FORM{'dataToSign'};
    28 unlink("signature");
    29 open(FILE1,">signature") || die("Cannot open file for writing\n");
    31 print FILE1 "$dataSignature";
    33 close(FILE1);
    36 unlink("data");
    37 open(FILE2,">data") || die("Cannot open file for writing\n");
    39 print FILE2 "$dataToSign";
    41 close(FILE2);
    44 print "<BR><B>Signed Data:</B><BR>", "$dataToSign", "<BR>";
    46 print "<BR><b>Verification Info:</b><BR>";
    48 $verInfo = `./signver -D . -s signature -d data -v`;
    49 print "<font color=red><b>$verInfo</b></font><BR>";
    51 print "<BR><B>Signature Data:</B><BR>", "$dataSignature", "<BR>";
    53 print "<BR><b>Signature Info:</b><BR>";
    55 foreach $line (`./signver -s signature -A`) {
    56      print "$line<BR>\n";
    57 }
    59 print "<b>End of Info</b><BR>";

mercurial