gpg --no-tty --no-auto-check-trustdb --batch --no-armor --always-trust -r 531B6686 -e /tmp/pius_tmp/pius_tmp
That is trying to encrypt (the -e option) the file /tmp/pius_tmp/pius_tmp, very little to do with signing a key. To sign a key, first import it: $ gpg --keyserver KEYSERVER --recv-keys KEYID Then check the fingerprint: $ gpg --fingerprint KEYID Finally, sign it: $ gpg --sign-key KEYID (If you have multiple private keys, pass the --default-key KEY-TO-USE option as well) And as a final step, so others can get an updated version of the key, upload it to a keyserver (yes, that is the KEYID of the key you just signed, not the key you used to sign it with!): $ gpg --keyserver KEYSERVER --send-key KEYID A good keyserver is certserver.pgp.com.
