PHP website
eggled at gmail.com
eggled at gmail.com
Tue Mar 23 18:11:15 CET 2010
On Tue, Mar 23, 2010 at 04:09:24PM +0000, Rhiannon Buck wrote:
> 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 rhiannon at 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
> <rhiannon at 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)
> [[1]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() [[2]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
>
>
>
>
>
> .
>
> References
>
> Visible links
> 1. https://secure40.securewebsession.com/timetogoveggie.com/vvfshop/function.fopen
> 2. https://secure40.securewebsession.com/timetogoveggie.com/vvfshop/function.filesize
> _______________________________________________
> Gnupg-users mailing list
> Gnupg-users at gnupg.org
> http://lists.gnupg.org/mailman/listinfo/gnupg-users
php is probably running as a different user.
Try running system("id -u") or system("whoami") and compare that to the
output from your login.
You will probably need to create a keyring for whichever user owns the
php process and fetch the necessary keys to encrypt the data.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: </pipermail/attachments/20100323/54914b2b/attachment.pgp>
More information about the Gnupg-users
mailing list