Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Situation: we plan on using PHP's GnuPG extension to encrypt/decrypt files.

Currently we've setup some test cases, using keys generated with GPG.

The generated files reside in:

/Users/username/.gnupg/

I am able to get keyinfo for the key I want to use to encrypt/decrypt, but when I attempt to use addencryptkey, I get:

(E_WARNING: 2): gnupg::addencryptkey() [gnupg.addencryptkey]: get_key failed

I think this is due to the permissions on the ~/.gnupg folder & enclosed files.

The files are owned by me - username, but apache runs as www.

A few days ago I did have this working, but it seems each time I use GPG Keychain Access to import / export a key, the folder's permissions are changed.

Question: What are the exact permissions required to allow PHP's GnuPG to add encrypt & decrypt keys?

share|improve this question

migrated from stackoverflow.com Jun 24 '11 at 12:40

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer 1

chmod 777 ~/.gnupg
cd ~/.gnupg
chown :apache_user pubring.gpg trustdb.gpg secring.gpg pubring.gpg~
chmod 660 pubring.gpg trustdb.gpg secring.gpg pubring.gpg~
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.