I missed an import in the callback function.
Here is the corrected version of the example:

GPG_KEY_UID = "xxx"
GPG_KEY_PASSPHRASE = "xxx"
from pyme import core, pygpgme
import pyme.errors
ciphertext = core.Data()
plaintext = core.Data(string="Test")
ctx = core.Context()
ctx.set_armor(1)
def _passphrase_callback(hint='', desc='', prev_bad=''): 
    """Callback function needed by pyme"""
    
    return GPG_KEY_PASSPHRASE

ctx.set_passphrase_cb(_passphrase_callback)
ctx.op_keylist_start(GPG_KEY_UID, 0)
sigkey = ctx.op_keylist_next()
ctx.signers_clear()
ctx.signers_add(sigkey)
ctx.op_sign(plaintext, ciphertext, pygpgme.GPGME_SIG_MODE_DETACH)



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to