[pycrypto] Public key algos usage

Lorenz Quack don at amberfisharts.com
Mon Nov 16 11:26:06 CST 2009


Hi Stefano,

As far as I know the API remains the same whether the key is a private/public key pair
or only the public key. So this should work (However, I didn't test this code):

 >>> message = "this is a secret"
 >>> pub_key = key_pair.publickey()
 >>> cipher_text = pub_key.encrypt(message, "")

I also think that the API-Reference [1] is fairly accurate.

I hope that helps. If not, maybe you show some code how you try to use it.

yours
//Lorenz

[1] http://www.dlitz.net/software/pycrypto/apidoc/


Kiwi wrote:
> I cannot find documentation on using PyCrypto's public keys algorithms.
> The main problem is that while I can easily create a private/public
> keypair and use it, I don't understand how to create an object given
> only a public key (encryption/verify only).
> The only documentation says to "look at the source code".
> What is the best thing to do at this time?
> Wait for a definitive API? Use a development version? Use the old
> undocumented API?
> Is there a code snipplet somewhere on using RSA or ElGamal with the current API?
> By the way I already use PyCrypto symmetric encryption in the
> application I'm writing and it works well and fast.
> 
> Thank you for your time,
> Stefano Cavallari
> _______________________________________________
> pycrypto mailing list
> pycrypto at lists.dlitz.net
> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto



More information about the pycrypto mailing list