I have GPG set up on my windows box and my linux box. I have the same keypairs on both. I can encrypt & decrypt on both systems fine when using the command line but i now want to automate things with pyme. Unfortunately, I have hit a problem which I cant get past. The scripts I have can enumerate keys and encrypt files & text easily, but whenever I decrypt it freezes dead. Here's an example
from pyme import core, constants
def Callback(x, y, z):
""" Callback to give password """
plaintext = "Hello World!"
crypttext = ""
#First set of data
plaindata1 = core.Data(plaintext)
cryptdata1 = core.Data()
cont = core.Context()
cont.op_keylist_start("MyKeyNameHere", 1) #use first key
cont.op_encrypt([cont.op_keylist_next()], 1, plaindata1, cryptdata1)
crypttext = cryptdata1.read()
print "Encrypted Data:\n %s" % crypttext
cryptdata2 = core.Data(crypttext)
plaindata2 = core.Data()
cont.op_decrypt(cryptdata2, plaindata2) #freeze here!!!!
print "Decrypted Data:\n %s" % crypttext
As I said, it freezes on both linux & windows, but on linux it brings up a dialog to get my passpharse. if I click cancel the script continues and decrypts the data as it should.
I've scoured the web and newsgroups and looked through the pyme & gpgme docs, but I cant figure it out! I cant understand why it's freezing. Any ideas?