note 82594 added to function.gnupg-encrypt
| From: | nickjohnson at osu1 dot php dot net | Date: | Thu, 17 Apr 2008 18:44:19 +0000 |
| Subject: | note 82594 added to function.gnupg-encrypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138415@lists.php.net to get a copy of this message | ||
After spending some time trying to get this extension to work, I've found that you have to have
the GNUPGHOME environment variable set so that the keychain can be found, and have it set equal to
the .gnupg directory itself, not the apache/httpd user's home directory (which is what is shown
in dan's example code). below is an example of this and a simple function I was working on at
the time to encrypt a piece of data for storage in a database.
<?php
// set the environment so gnupg can find the keyring
putenv("GNUPGHOME=/home/apache/.gnupg");
function encrypt_string($str,$fingerprint) {
$res = gnupg_init();
gnupg_addencryptkey($res,$fingerprint);
$enc = gnupg_encrypt($res, $str);
return $enc;
}
?>
----
Server IP: 209.41.74.194
Probable Submitter: 66.249.252.179
----
Manual Page -- http://www.php.net/manual/en/function.gnupg-encrypt.php
Edit -- https://master.php.net/note/edit/82594
Del: integrated -- https://master.php.net/note/delete/82594/integrated
Del: useless -- https://master.php.net/note/delete/82594/useless
Del: bad code -- https://master.php.net/note/delete/82594/bad+code
Del: spam -- https://master.php.net/note/delete/82594/spam
Del: non-english -- https://master.php.net/note/delete/82594/non-english
Del: in docs -- https://master.php.net/note/delete/82594/in+docs
Del: other reasons-- https://master.php.net/note/delete/82594
Reject -- https://master.php.net/note/reject/82594
Search -- https://master.php.net/manage/user-notes.php