I wrote 2 scripts;
This script WORKS GREAT via command line; %perl -Tw pipetogpg.cgi
# START PIPETOGPG.CGI $ENV{"PATH"} = ""; system('echo "this is a longer test message" | /usr/local/bin/gpg -ear + docwebb > ./Temp/encrypted_file.gpg'); exit; # EOF
This script does NOT WORK (supposed to work via web browser) but it writes an empty file;
#!/usr/bin/perl -Tw use strict; use CGI::Carp qw/fatalsToBrowser/; &encrypt_data; print "Content-type: text/html\n\n"; print "done<BR>"; exit; sub encrypt_data { my $old_path = $ENV{"PATH"}; # CLEAR ENV{"PATH"} SO PERL DOESN'T COMPLAIN ABOUT TAINTED DATA $ENV{"PATH"}=""; # PATH CLEARED ABOVE SO WE NEED A FULL PATH IN THE COMMAND LINE system('echo "this is a longer test message" | /usr/local/bin/gpg - +ear testkey > ./Temp/encrypted_file.asc'); # RESTORE PATH $ENV{"PATH"} = $old_path; } #EOF
I do NOT understand why almost identical code produces an empty file
Thanks
Russ
In reply to piping data to GnuPG creates empty file by rtaylor1956
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |