Here is a minimal example:

$ python
Python 2.6.5+ (release26-maint, Jul  6 2010, 12:58:20) 
[GCC 4.4.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 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"""
...     
...     from config import GPG_KEY_PASSPHRASE
...     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)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/dist-packages/pyme/util.py", line 64, in
_funcwrap "Invocation of " + name)
  File "/usr/lib/python2.6/dist-packages/pyme/errors.py", line 46, in
errorcheck raise GPGMEError(retval, extradata)
pyme.errors.GPGMEError: Invocation of gpgme_op_sign: Unspecified
source: General error (0,1)
>>> 



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

Reply via email to