python function for retrieving key and encryption
Piet van Oostrum
piet at cs.uu.nl
Tue Jul 21 11:59:47 EDT 2009
>>>>> jayshree <jayshree06comp at gmail.com> (j) wrote:
>j> M2Crypto package not showing the 'recipient_public_key.pem' file at
>j> linux terminal .how do i get/connect with recipient public key.
>j> exactly i need to check how can i open this file through linux
>j> import M2Crypto def encrypt(): recip = M2Crypto.RSA.load_pub_key(open
>j> ('recipient_public_key.pem','rb').read()) print recip; plaintext =
>j> whatever i need to encrypt msg = recip.public_encrypt
>j> (plaintext,RSA.pkcs1_padding) print msg;
>j> after calling the function its not giving any output and even any
>j> i also tried as 'Will' said
>j> pk = open('public_key.pem','rb').read() print pk; rsa =
>j> whats the mistake i am not getting .will somebody help me out.
>j> is something wrong in opening 'recipient_public_key.pem'. is M2Crypto
>j> contain this file inbuilt .from where this file taking public key of
>j> the recipient i'. what this file contain and how it will work .should
>j> i need to create such a file for my purpose.if it is then how can i
>j> create this and how it will retrieve the key,where i recognize my
>j> recipient to get his public key .is something like database at server.
>j> please give me a quick response......
>j> looking for your answer.
1. Type your python code with newlines and proper indentation.
2. Show the error messages that your code gives when you run it.
3. Use proper capital letters at the beginning of your sentences.
4. Don't fire so many questions in rapid succession.
The recipient_public_key.pem file is the public key of the recipient
which means the person that is going to receive the encrypted message.
You should get it from the recipient him/herself or from some key store
where s/he has deposited it.
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org
More information about the Python-list