stupid question, but did you try: rsa = M2Crypto.RSA.load_pub_key( file("pubkey.pem") ) It is not clear from the documentation what they want for "file" (and because Python has no type declarations, you are left to guess...). May not work... just thought I would ask.