The example[2,3,4].py files in the ezPyCrypto are instructive. Using the techniques in those files and modifying your test script, the desired behavior is attainable.
Two items had to be changed. Instead of k.exportKey(), you have to use k.exportKeyPrivate(). On the other end instead of ke.decString() you have to use the decStringFromAscii() method. ----------------amended script------------------------------ import os import ezPyCrypto ####################################################################### KEY_FILE = '/Users/scott/pyprogs/the_key.txt' ####################################################################### msg = 'Meeting delayed 30 hours' print "plaintext msg: %s" % msg print '-' * 48 k = ezPyCrypto.key(512) cipher = k.encStringToAscii(msg) print cipher print '-' * 48 decoded1 = k.decStringFromAscii(cipher) print "recovered msg: %s" % decoded1 print '-' * 48, '\n' # So far so good. encrypted and decrypted as expected. # Now try to put the key in a file for transport on eg a USB drive. pubPrivKey = k.exportKeyPrivate() print "pubPrivKey:\n%s" % pubPrivKey f = open(TEST_KEY_FILE, 'w') f.write(pubPrivKey) f.close() print "pubPrivKey written to file -> %s" % os.path.basename(KEY_FILE) print '-' * 48, '\n' # Now get string representation of pubPrivKey and use it to create # a new key instance (nk) that can be used to decode the cipher f = open(TEST_KEY_FILE, 'r') inPubPrivKey = f.read() f.close() # create a new key object and auto-import private key nk = ezPyCrypto.key(inPubPrivKey) print "pubPrivKey read in from file -> %s, new key instance created" % \ os.path.basename(KEY_FILE) decoded2 = nk.decStringFromAscii(cipher) print "recovered msg using pubPrivKey: %s" % decoded2 ----------------end script------------------------------ Happy en/de crypting... Kip Lehman kipster <dash> t <at> earthlink <dot> net -- Still waiting for PanAm, Amtrack and the USPS to deliver my .sig -- http://mail.python.org/mailman/listinfo/python-list