Re: python function for retrieving key and encryption



On Jul 23, 5:48 pm, Piet van Oostrum <p...@xxxxxxxx> wrote:
jayshree <jayshree06c...@xxxxxxxxx> (j) wrote:
j> On Jul 21, 8:59 pm, Piet van Oostrum <p...@xxxxxxxx> 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
.



Relevant Pages

  • Re: python function for retrieving key and encryption
    ... j> linux terminal .how do i get/connect with recipient public key. ... j> whatever i need to encrypt msg = recip.public_encrypt ... j> print msg; ...
    (comp.lang.python)
  • Re: Entourage mail and PGP/GPG?
    ... > You can digitally sign messages and encrypt them using CA. ... > using a certificate for each recipient. ... > recipient uses this certificate to verify which private key was ...
    (microsoft.public.mac.office.entourage)
  • Re: Why El Gamal?
    ... in PGP, and have found nothing in the GPG man page. ... keys for each recipient, they would have to create separate ciphertexts ... cause a large overhead for them -- they'll have to encrypt and transfer ...
    (sci.crypt)
  • Re: Cryptography (Encryption)
    ... > The problem is that I have to store in my DB outgoing mails to prove I ... and if I encrypt them (with end user public key) and store ... of the recipient certificate). ...
    (microsoft.public.platformsdk.security)
  • Re: Secure email solution
    ... > I want to be able to encrypt email messages and attachments and make sure ... > I was able to play with PGP and it works great but the public key needs to ... without 1) passing public key/obtaining a CA or 2) securely passing the ... obtain a public key or pass the recipient or the sender a password ...
    (alt.computer.security)