RSA with PyCrypto

Tommy Lindgren tomyltomyl at linuxlinux.nu
Wed Dec 11 17:47:47 EST 2002


"A.M. Kuchling" <amk at amk.ca> writes:

Ooo.. The Creator himself speaks ;)

> RSA keys are like this.  Given the public key, anyone can take a
> message and encrypt it using the key.  Only the person who has the
> private key can reverse this encryption to get the original message.

Aha, okay. I think my confusion (about the exchange of public keys)
was due to my wish that the receiver can verify the sender. I guess
this is done by providing a hash signature in the message (as shown
in the RSA example in the documentation).
 
> So, in your example, A doesn't need an RSA key at all.  A simply needs
> to get a copy of B's public key, does 'msgc = pubkeyB.encrypt(msg,"")'
> and sends msgc to B.  B then does 'msgd = privkeyB.decrypt(msgc)' 
> to retrieve the original message.

Nice! I was pretty sure my code was ugly when the rest of the API
was so beautiful :)

Thanks!

-- 
Tommy Lindgren  |  o y @ i u . u
41A942131CAA5C  | t m l l n x n
^C^C



More information about the Python-list mailing list