[pycrypto] Public key algos usage
Kiwi
spiky.kiwi at gmail.com
Mon Nov 16 17:42:23 CST 2009
On Mon, Nov 16, 2009 at 6:26 PM, Lorenz Quack <don at amberfisharts.com> wrote:
> 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.
>
Thank you for the fast answer.
I understand the code above.
Still something is not clear to me.
And how do I export the public key (or a keypair) to a string? How do
I import it back?
I want just the key so it can be reused by other libraries and future
versions of this one, so I cannot just serialize the object.
More information about the pycrypto
mailing list