I am running into a problem with pycrypto public key encryption. Encryption works fine when I have the private key, but when I import just the public key encryption fails:
In [85]: import Crypto.PublicKey.RSA
In [86]: key = Crypto.PublicKey.RSA.importKey(open('/etc/pki/server.pub', 'r').read())
In [87]: key.
In [87]: key.encrypt('cheese', 32)
Out[87]: ('cheese',)
Last I checked that does not look encrypted. Can anyone help me see what I am missing in the pycrypto api?