Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | #! /usr/bin/perl |
michael@0 | 2 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 5 | |
michael@0 | 6 | |
michael@0 | 7 | |
michael@0 | 8 | sub decode { |
michael@0 | 9 | read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); |
michael@0 | 10 | @pairs = split(/&/, $buffer); |
michael@0 | 11 | foreach $pair (@pairs) |
michael@0 | 12 | { |
michael@0 | 13 | ($name, $value) = split(/=/, $pair); |
michael@0 | 14 | $value =~tr/+/ /; |
michael@0 | 15 | $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; |
michael@0 | 16 | $FORM{$name} = $value; |
michael@0 | 17 | # print "name=$name value=$value<BR>\n"; |
michael@0 | 18 | } |
michael@0 | 19 | } |
michael@0 | 20 | |
michael@0 | 21 | print "Content-type: text/html\n\n"; |
michael@0 | 22 | |
michael@0 | 23 | &decode(); |
michael@0 | 24 | |
michael@0 | 25 | $dataSignature = $FORM{'dataSignature'}; |
michael@0 | 26 | $dataToSign = $FORM{'dataToSign'}; |
michael@0 | 27 | |
michael@0 | 28 | unlink("signature"); |
michael@0 | 29 | open(FILE1,">signature") || die("Cannot open file for writing\n"); |
michael@0 | 30 | |
michael@0 | 31 | print FILE1 "$dataSignature"; |
michael@0 | 32 | |
michael@0 | 33 | close(FILE1); |
michael@0 | 34 | |
michael@0 | 35 | |
michael@0 | 36 | unlink("data"); |
michael@0 | 37 | open(FILE2,">data") || die("Cannot open file for writing\n"); |
michael@0 | 38 | |
michael@0 | 39 | print FILE2 "$dataToSign"; |
michael@0 | 40 | |
michael@0 | 41 | close(FILE2); |
michael@0 | 42 | |
michael@0 | 43 | |
michael@0 | 44 | print "<BR><B>Signed Data:</B><BR>", "$dataToSign", "<BR>"; |
michael@0 | 45 | |
michael@0 | 46 | print "<BR><b>Verification Info:</b><BR>"; |
michael@0 | 47 | |
michael@0 | 48 | $verInfo = `./signver -D . -s signature -d data -v`; |
michael@0 | 49 | print "<font color=red><b>$verInfo</b></font><BR>"; |
michael@0 | 50 | |
michael@0 | 51 | print "<BR><B>Signature Data:</B><BR>", "$dataSignature", "<BR>"; |
michael@0 | 52 | |
michael@0 | 53 | print "<BR><b>Signature Info:</b><BR>"; |
michael@0 | 54 | |
michael@0 | 55 | foreach $line (`./signver -s signature -A`) { |
michael@0 | 56 | print "$line<BR>\n"; |
michael@0 | 57 | } |
michael@0 | 58 | |
michael@0 | 59 | print "<b>End of Info</b><BR>"; |
michael@0 | 60 |