simple rsa from javascript to python

Astan Chee astan.chee at gmail.com
Mon Apr 2 19:19:05 EDT 2012


Hi,
I've got a simple javascript that looks like this:

var public_key_mod =
"B99808B881F3D8A620F043D70B89674C0A120417FBD3690B3472589C641AD5D422502D0B26CADF97E2CB618DDDBD06CA0619EBBFB328A2FA31BD0F272FE3791810546E04BF42F05DB620FC7B4D0A2EAA17C18FF30C84D93341205C1D6EAD6ACBF2F08E334049DEBF31555CF164AD5CCE437B1AB5EFFEE1FF38552B63EDEF74861E665D90D5AB76D85F5242F42BA29F20EC64553D08020C1E37909341A25F339F802A83EE65E1559AC1CDFE0837160759770D27A058CED0C3771356BCAC8739A0FEF8F344CF64833CDDECC41BBE76BB2F1F8229EB04C72FABA91E4798A3DDFD9100A5171490B30F30EAADF6FDA7677F63CD77D1E6E88F79A6CED5A4966DD6459F";
var public_key_exp = "010001";
var my_text = "this is a text.,)";
var public_key = RSA.getPublicKey( public_key_mod, public_key_exp );
var encrypted_text = RSA.encrypt( my_text, public_key );

and I'm trying to convert this into python and I'm rather stuck with
pycrypto as there is no example on how to make the public key with a
mod and exponent (or I've probably missed it).
Thanks for any help!



More information about the Python-list mailing list