mcunn
08-04-2009, 10:07 AM
I'm hitting my head against the wall trying to build a working gnuPG install. Im trying to use the following sample code which returns an error:
Class 'gnupg' not found in /home7/[Username]/public_html/synergytest/script.php
I've installed GNUPG via cpanel and have a valid key setup. I know I'm missing something stupid with the path but I'm on 4+ hours staring at the thing.
Thanks!
Michael
---
$CONFIG['gnupg_home'] = '/home/[myusername]/.gnupg';
$CONFIG['gnupg_fingerprint'] = '[myfingerprint';
$data = 'this is some confidential information';
$gpg = new gnupg();
putenv("GNUPGHOME={$CONFIG['gnupg_home']}");
$gpg->seterrormode(GNUPG_ERROR_SILENT);
$gpg->addencryptkey($CONFIG['gnupg_fingerprint']);
$encrypted = $this->gpg->encrypt($data);
echo "Encrypted text: \n<pre>$encrypted</pre>\n";
// Then use something like this to decrypt the data.
$passphrase = 'Your_secret_passphrase';
$gpg->adddecryptkey($CONFIG['gnugp_fingerprint'], $passphrase);
$decrypted = $gpg->decrypt($encrypted);
echo "Decrypted text: $decrypted";
?>
---
Class 'gnupg' not found in /home7/[Username]/public_html/synergytest/script.php
I've installed GNUPG via cpanel and have a valid key setup. I know I'm missing something stupid with the path but I'm on 4+ hours staring at the thing.
Thanks!
Michael
---
$CONFIG['gnupg_home'] = '/home/[myusername]/.gnupg';
$CONFIG['gnupg_fingerprint'] = '[myfingerprint';
$data = 'this is some confidential information';
$gpg = new gnupg();
putenv("GNUPGHOME={$CONFIG['gnupg_home']}");
$gpg->seterrormode(GNUPG_ERROR_SILENT);
$gpg->addencryptkey($CONFIG['gnupg_fingerprint']);
$encrypted = $this->gpg->encrypt($data);
echo "Encrypted text: \n<pre>$encrypted</pre>\n";
// Then use something like this to decrypt the data.
$passphrase = 'Your_secret_passphrase';
$gpg->adddecryptkey($CONFIG['gnugp_fingerprint'], $passphrase);
$decrypted = $gpg->decrypt($encrypted);
echo "Decrypted text: $decrypted";
?>
---