I need to use gnupg_decrypt
to decrypt a file that is being sent to us but can't get it working.
When I use the gnupg_keyinfo
to list all the public keys, it returns an empty array. Does anyone have any idea why this is happening?
The code I am using is:
$res = gnupg_init();
$info = gnupg_keyinfo($res, '');
print_r($info);
Looking at the comments of the above link putting ''
as the pattern it should list all keys.
I have set up a public key on my server using the info provided here http://irtfweb.ifa.hawaii.edu/~lockhart/gpg/gpg-cs.html
And when I run gpg --list-keys it shows it as being successfully created.
I have read somewhere that you have to put
putenv('GNUPGHOME=/tmp');
at the top of the page in order for it to work but there is no reference to the key in that folder and I can't find out what location to set with the above.
I also read I may not have permission to the folder the key is stored in but again I am not sure where it is.
Could anyone help with this?
Thank you
To get this working I did the following
chown -R {{user}} ~/.gnupg
chmod 600 ~/.gnupg/*
chmod 700 ~/.gnupg
Then reimported the key using gnupg_import
function