I'm trying to do public key encryption on a file so that I can ftp
it to a server later.

I have a very small, simple script:

use GnuPG;
use strict;
use warnings;
my $secret= "thisisatest";
my $recipient = "[EMAIL PROTECTED]";

my $gpg = new GnuPG();
$gpg->encrypt ( plaintext => "testfile.txt", output => "testfile.gpg",
                recipient => $recipient, passphrase => $secret,
                armor => 1 );

where $secret is the passphrase for the script owners private key and
$recipient is the address of the user I'm sending to, and their public
key has been imported into the script owners public keyring.  I fully
understand the security implications of keeping the passphrase in
a variable in the script, and the production version will use a different,
more secure method.

The file "testfile.txt" contains the text:

This is unencrypted text. 

However, whenever I run the script testfile.gpg is created -- but
it is empty.

I don't know where to go from here.  I've tried using other PK encryption
modules, but this is the only one I could get to compile and install.
I get no error messages (btw, if you get a bareword failure with the
GnuPG module, you need to change the line:

my $max_fd = POSIX::sysconf( POSIX::_SC_OPEN_MAX ) || 256;

to

my $max_fd = POSIX::sysconf( POSIX::_SC_OPEN_MAX() ) || 256;

in your GnuPG.pm file, which might be located in site_perl,)
and without error messages I'm stumped as to what I've done
wrong.

I'm testing on a WBEL 3 Linux box, if that matters.  Yes, I know,
switch to Centos -- someday. :)  But for now, this is what this needs to
run on.

I've tried encrypting other files, I've tried using absolute paths and
I've tried various iterations of the options in the encrypt function.
But, ultimately, I've go no idea what I'm doing.

Any ideas?  Pointers?

Thanks,

--J(K)

PS:  the ultimate goal here is to allow a user to upload a pdf or tiff
file to a web server, change the name to a conforming name, zip the
file, encrypt the file and finally ftp it to the destination.  Everything
but the encryption is working.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to