note 116193 deleted from function.gnupg-import by salathe

From: Date: Fri, 21 Nov 2014 14:59:05 +0000
Subject: note 116193 deleted from function.gnupg-import by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-200991@lists.php.net to get a copy of this message
Note Submitter: vangelier at hotmail dot com ---- Yes so, I was also stuck on this shit. And nobody doesn't bother to leave a comment so i will. If you want to import keys, make sure ~/.gnupg is 0757. So, chmod -R 0757 ~gnupg What i did on CentOS (more safe) is the following: chmod -R 0757 /usr/share/httpd/.gnupg sudo -u apache gpg --allow-secret-key-import --import My-PrivateKey.asc Show the fingerprint to use with $pgp->adddecryptionkey etc. sudo -u apache gpg --fingerprint Then: $gpg = new gnupg(); $gpg->seterrormode(gnupg::ERROR_EXCEPTION); try{ $key = $gpg->import(file_get_contents("../CarPal-PrivateKey.asc")); if($key['fingerprint'] != "THATONEFINGERPRINT"){ echo "<b>Je hebt de key nog niet geimporteerd!.<b/>"; } $gpg->adddecryptkey('THATONEFINGERPRINT', '@DifficultPassword!'); }catch(Exception $err){ echo "<pre>"; print_r($err); } echo $gpg->decrypt('EncryptedText');

« previous php.notes (#200991) next »