python function for retrieving key and encryption

jayshree jayshree06comp at gmail.com
Tue Jul 21 02:29:06 EDT 2009


M2Crypto package not showing the 'recipient_public_key.pem' file at
linux terminal .how do i get/connect with recipient public key.

exactly i need to check how can i open this file through linux
commands.

import M2Crypto def encrypt(): recip = M2Crypto.RSA.load_pub_key(open
('recipient_public_key.pem','rb').read()) print recip; plaintext =
whatever i need to encrypt msg = recip.public_encrypt
(plaintext,RSA.pkcs1_padding) print msg;

after calling the function its not giving any output and even any
error

i also tried as 'Will' said

pk = open('public_key.pem','rb').read() print pk; rsa =
M2Crypto.RSA.load_pub_key(pk)

whats the mistake i am not getting .will somebody help me out.
is something wrong in opening 'recipient_public_key.pem'. is M2Crypto
contain this file inbuilt .from where this file taking public key of
the recipient i'. what this file contain and how it will work .should
i need to create such a file for my purpose.if it is then how can i
create this  and how it will retrieve the key,where i recognize my
recipient to get his public key .is something like database at server.

please give me a quick response......
looking for your answer.



More information about the Python-list mailing list