Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9

Thread: GPG and PHP

  1. #1
    Regular Coder
    Join Date
    May 2002
    Location
    London, England
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts

    GPG and PHP

    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
    Jeewhizz - MySQL Moderator
    http://www.sitehq.co.uk
    PHP and MySQL Hosting

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    GPG? Huh? What? PGP?
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    Regular Coder
    Join Date
    May 2002
    Location
    London, England
    Posts
    367
    Thanks
    0
    Thanked 0 Times in 0 Posts
    GPG = Gnu version of PGP
    Jeewhizz - MySQL Moderator
    http://www.sitehq.co.uk
    PHP and MySQL Hosting

  • #4
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Originally posted by Jeewhizz
    GPG = Gnu version of PGP
    figures
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #5
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #6
    New Coder
    Join Date
    Feb 2007
    Posts
    36
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Hi,

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

    Greetings

  • #7
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Are you sure? The title and content of the tutorial beg to differ.

  • #8
    New Coder
    Join Date
    Feb 2007
    Posts
    36
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Inigoesdr View Post
    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.

  • #9
    New Coder
    Join Date
    Feb 2007
    Posts
    36
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Jeewhizz View Post
    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
    Last edited by Rocko; 08-21-2007 at 05:48 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •