michael@0: #! /usr/bin/perl
michael@0: # This Source Code Form is subject to the terms of the Mozilla Public
michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0:
michael@0:
michael@0:
michael@0: sub decode {
michael@0: read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
michael@0: @pairs = split(/&/, $buffer);
michael@0: foreach $pair (@pairs)
michael@0: {
michael@0: ($name, $value) = split(/=/, $pair);
michael@0: $value =~tr/+/ /;
michael@0: $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
michael@0: $FORM{$name} = $value;
michael@0: # print "name=$name value=$value
\n";
michael@0: }
michael@0: }
michael@0:
michael@0: print "Content-type: text/html\n\n";
michael@0:
michael@0: &decode();
michael@0:
michael@0: $dataSignature = $FORM{'dataSignature'};
michael@0: $dataToSign = $FORM{'dataToSign'};
michael@0:
michael@0: unlink("signature");
michael@0: open(FILE1,">signature") || die("Cannot open file for writing\n");
michael@0:
michael@0: print FILE1 "$dataSignature";
michael@0:
michael@0: close(FILE1);
michael@0:
michael@0:
michael@0: unlink("data");
michael@0: open(FILE2,">data") || die("Cannot open file for writing\n");
michael@0:
michael@0: print FILE2 "$dataToSign";
michael@0:
michael@0: close(FILE2);
michael@0:
michael@0:
michael@0: print "
Signed Data:
", "$dataToSign", "
";
michael@0:
michael@0: print "
Verification Info:
";
michael@0:
michael@0: $verInfo = `./signver -D . -s signature -d data -v`;
michael@0: print "$verInfo
";
michael@0:
michael@0: print "
Signature Data:
", "$dataSignature", "
";
michael@0:
michael@0: print "
Signature Info:
";
michael@0:
michael@0: foreach $line (`./signver -s signature -A`) {
michael@0: print "$line
\n";
michael@0: }
michael@0:
michael@0: print "End of Info
";
michael@0: