Hello

After moving servers I was having trouble with GnuPG so I generated a new set 
of keys in my own name. They work in the command line:
gpg --encrypt -ao encrypteddata -r rhian...@viva.org.uk data

But not in my PHP code.
Are there any PHP geniuses out there?
This is the bit that doesn't work at all (errors listed below).
----------------------------------------------------------------------------------------------------------------------------------------------
//invoke PGP to encrypt file contents
system("/usr/bin/gpg --encrypt -ao $crypted -r 'Rhiannon 
<rhian...@viva.org.uk>' $plainTxt");

//open file and read encrypted contents into var
$fd = fopen($crypted, "r");
$encrypted_stuff = fread($fd, filesize($crypted));
fclose($fd);
----------------------------------------------------------------------------------------------------------------------------------------------

If I make the fopen "w+" it does create the file, but it is empty at 0 bytes.

As I said, it works beautifully from the command line - my new user is able to 
encrypt and decrypt.

Many Thanks

Rhiannon

----------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------

Errors:

Warning: 
fopen(/services/webpages/t/i/timetogoveggie.com/90bfb3b11eb247df93c4a7470e058b96pgpdata)
 
[function.fopen<https://secure40.securewebsession.com/timetogoveggie.com/vvfshop/function.fopen>]:
 failed to open stream: No such file or directory in 
/services4/webpages/util/v/i/vivacaa.site.aplus.net/public/vvfshop/processform2.php
 on line 137

Warning: filesize() 
[function.filesize<https://secure40.securewebsession.com/timetogoveggie.com/vvfshop/function.filesize>]:
 stat failed for 
/services/webpages/t/i/timetogoveggie.com/90bfb3b11eb247df93c4a7470e058b96pgpdata
 in 
/services4/webpages/util/v/i/vivacaa.site.aplus.net/public/vvfshop/processform2.php
 on line 138

Warning: fread(): supplied argument is not a valid stream resource in 
/services4/webpages/util/v/i/vivacaa.site.aplus.net/public/vvfshop/processform2.php
 on line 138

Warning: fclose(): supplied argument is not a valid stream resource in 
/services4/webpages/util/v/i/vivacaa.site.aplus.net/public/vvfshop/processform2.php
 on line 139


_______________________________________________
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users

Reply via email to