How to decrypt string in php
David Jourard
support at bytesinteractive.com
Wed Nov 10 20:08:28 CET 2010
Hi,
I have a gpg encypted string in a data field and I want to be able decrypt
it.
Is there a simple way to do this without writing it to a file on a windows
machine
Here is my code example:
<?php
function DecryptGPG ($string) {
$gpg = 'c:/locationofgnupg/gpg';
$passphrase = 'mypassword';
$cmdline = "$gpg --no-secmem-warning --batch --passphrase
$passphrase --decrypt $string";
exec ($cmdline, $stdout, $return);
$finalstring = $stdout[0];
return $finalstring;
}
$finalvalue = DecryptGPG($encryptedstuff);
echo "value=$finalvalue\n";
?>
With this code I get: Invalid Option "-----BEGIN" which I understand why.
regards
David J.
More information about the Gnupg-users
mailing list