CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Pyme problems

  1. #1
    Join Date
    Jul 2008
    Posts
    1

    Pyme problems

    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
    Code:
        from pyme import core, constants
    
        def Callback(x, y, z):
            """ Callback to give password """
            return "MyPasswordHere\n"
    
        plaintext = "Hello World!"
        crypttext = ""
        #First set of data
        plaindata1 = core.Data(plaintext)
        cryptdata1 = core.Data()
    
        cont = core.Context()
        cont.set_armor(True) #ASCII
    
        cont.op_keylist_start("MyKeyNameHere", 1) #use first key
        cont.op_encrypt([cont.op_keylist_next()], 1, plaindata1, cryptdata1)
        cryptdata1.seek(0,0)
        crypttext = cryptdata1.read()
        print "Encrypted Data:\n %s" % crypttext
    
        cryptdata2 = core.Data(crypttext)
        plaindata2 = core.Data()
        cont.set_passphrase_cb(Callback)
        cont.op_decrypt(cryptdata2, plaindata2) #freeze here!!!!
        plaindata2.seek(0,0)
        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?

  2. #2
    Join Date
    Nov 2009
    Posts
    1

    Re: Pyme problems

    Hi, did anyone solve this problem? Thanks!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured