PHP with GPG

Derek Vokey derek@golfcowansville.com
Tue Nov 13 16:24:02 2001


Hi,
here are some of scripts that may help

to import keys:

<?php
putenv("GNUPGHOME/path/to/your dir/.gnupg ");
echo exec("/usr/bin/gpg -vv --homedir /path/to/your/.gnupg --import
/path/to/your dir/yourkey.asc 2>&1",$e)."<br>";
while( $res=each($e) )
{ 
echo "$res[1]<BR>"; 
}
?>

generate key rings for php user nobody
<?php
putenv("GNUPGHOME/path/to/your dir/.gnupg ");
echo exec("/usr/bin/gpg -vv --homedir --homedir /path/to/your/.gnupg --gen-key 2>&1",$e)
while( $res=each($e) ) 
{ 
echo "$res[1]<BR>"; 
}
?>

list keys belonging to php user nobody

<?php
putenv("GNUPGHOME/path/to/your dir/.gnupg ");
echo exec("/usr/bin/gpg -vv --homedir /path/to/your/.gnupg --list-keys 2>&1",$e)."<br>"; 
while( $res=each($e) ) 
{ 
echo "$res[1]<BR>"; 
}
?>
Hope some of this helps
Derek
-----Original Message-----
From: Gary Brooks <gary@fieldside.co.uk>
To: gnupg-users@gnupg.org <gnupg-users@gnupg.org>
Date: Tuesday, November 13, 2001 9:22 AM
Subject: PHP with GPG


>I am still having problems trying to get the system or exec (gpg --help
>works, but encryption or gpg --list-keys fails) commands to work from PHP.
>I get a RETURN VALUE of 2.  Please can anybody tell me what this means so
>that I can tell the system administrator whether the permissions etc. are
>correct.
>
>Thanks
>
>Gary Brooks
>
>
>_______________________________________________
>Gnupg-users mailing list
>Gnupg-users@gnupg.org
>http://lists.gnupg.org/mailman/listinfo/gnupg-users
>