...

View Full Version : GPG and PHP



Jeewhizz
05-22-2003, 05:43 PM
OK, i need to use gpg to encrypt some form data...

echo "hello" | gpg --always-trust -ear cs@sitehq.co.uk

works fine on the command line, but not for exec, shell_exec(), passthru() and system() etc etc...

Does anyone know how to use it? I can use other system commands and get the result - its just this gpg string!

Oh.. safemode is OFF!

Thanks

Jee

Spookster
05-22-2003, 05:50 PM
GPG? Huh? What? PGP?

Jeewhizz
05-22-2003, 06:09 PM
GPG = Gnu version of PGP :)

Spookster
05-22-2003, 08:17 PM
Originally posted by Jeewhizz
GPG = Gnu version of PGP :)

figures :thumbsup:

Spookster
05-24-2003, 09:38 PM
Here is a tutorial on it:

http://www.zend.com/zend/tut/tutorial-brogdon.php

Rocko
08-21-2007, 03:20 AM
Hi,

I reopen this threat because the mentioned tutorial does not explain how to execute GPG within PHP.

Greetings

Inigoesdr
08-21-2007, 03:28 AM
Are you sure? The title and content of the tutorial beg to differ.

Rocko
08-21-2007, 03:33 AM
Are you sure? The title and content of the tutorial beg to differ.

Indeed, the tutorial assumes you can execute GPG within PHP but does not say how to set the permissions in case you do not. It just tell some scripts.

Rocko
08-21-2007, 05:45 AM
OK, i need to use gpg to encrypt some form data...

echo "hello" | gpg --always-trust -ear cs@sitehq.co.uk

works fine on the command line, but not for exec, shell_exec(), passthru() and system() etc etc...

Does anyone know how to use it? I can use other system commands and get the result - its just this gpg string!

Oh.. safemode is OFF!

Thanks

Jee

The problem is the file permissions. The PHP script belongs to a different owner and group than the rest of the files.

To grant access at least this can be done:
chmod 770 /domain path/.gnupg

The files within:
chmod 604 trustdb.gpg
chmod 604 secring.gpg
chmod 604 random_seed
chmod 644 pubring.gpg

It may cause a warning message when executing gpg from command line:
gpg: WARNING: unsafe permissions on homedir "/domain path/.gnupg"

Note domain path can be /var/www/vhosts/mydomain.com/.gnupg

Best Regards,

Rocko



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum