I'm using the rsa module (easy_install rsa), and if I use it from command line:
import rsa
public,private = rsa.gen_pubpriv_keys(3)
cipher=rsa.encrypt("test",public)
rsa.decrypt("cipher",private)
this will return test again. (like expected)
but in my code it gives a zlib error -3 incorrect headers
def RSA(txt):
global crypt
if crypt=="en":
key=raw_input("Public key:")
ciphertext=rsa.encrypt(txt,eval(key))
else:
key=raw_input("Private key:")
ciphertext=rsa.decrypt(txt,eval(key))
return ciphertext
I really don't know where the problem is =( txt is a string, eval(key) is a dict...
and it is btw only the decryption that fails, the encryption works like a charm...
please help me =)