Re: python function for retrieving key and encryption
- From: jayshree <jayshree06comp@xxxxxxxxx>
- Date: Sun, 26 Jul 2009 23:47:00 -0700 (PDT)
On Jul 23, 5:48 pm, Piet van Oostrum <p...@xxxxxxxx> wrote:
j> On Jul 21, 8:59 pm, Piet van Oostrum <p...@xxxxxxxx> wrote:jayshree <jayshree06c...@xxxxxxxxx> (j) wrote:
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.
[...]
j> error coming like - IOError: [Errno 2] No such file or directory:
j> 'recipient_public_key.pem'
j> Is this not the inbuilt file.
j> How should i create such type of file.
You don't create it. See above. If you understand what is is you know
why it can't be builtin. If you don't understand it is better if you
first learn about OpenSSL, otherwise you run the risk to make serious
errors.
If you are just experimenting to create a message for yourself then you
have to create the public key because you are then the recipient
yourself. That has been answered onhttp://stackoverflow.com/questions/1169798/m2crypto-package
--
Piet van Oostrum <p...@xxxxxxxx>
URL:http://pietvanoostrum.com[PGP 8DAE142BE17999C4]
Private email: p...@xxxxxxxxxxxxxx
import M2Crypto
from M2Crypto import RSA,SSL
def encrypt():
pk = open('my_key.public.pem', 'rb').read()
rsa = M2Crypto.RSA.load_pub_key(pk) #return a M2Crypto.RSA.RSA_pub
object.
plaintext = 4545479545655576767767686688782344
msg = rsa.public_encrypt(plaintext,RSA.pkcs1_padding)
print msg;
encrypt()
This is code i am refering.
The Problem is coming with .pem file.
I also asked this questions at http://stackoverflow.com/questions/1176864/problem-with-the-pem-file-closed
which has not been answered .
please help me out....
thanks
.
- Follow-Ups:
- Re: python function for retrieving key and encryption
- From: Piet van Oostrum
- Re: python function for retrieving key and encryption
- References:
- python function for retrieving key and encryption
- From: jayshree
- Re: python function for retrieving key and encryption
- From: Piet van Oostrum
- Re: python function for retrieving key and encryption
- From: jayshree
- Re: python function for retrieving key and encryption
- From: Piet van Oostrum
- python function for retrieving key and encryption
- Prev by Date: Jackson was not my father: Omer Bhatti
- Next by Date: Re: Help understanding the decisions *behind* python? - immutable objects
- Previous by thread: Re: python function for retrieving key and encryption
- Next by thread: Re: python function for retrieving key and encryption
- Index(es):
Relevant Pages
|