I have this JavaScript code to encrypt text using RSA, and I need one que generates the same encrypted message, but that works with Python.
JavaScript code I'm using:
var key = new RSAKeyPair(
"2f9ac975a8a20c1b108e678904b42aa1",
"",
"4a5670127da1fd4e2a51685faff367f9"
);
...
I'm having trouble finding an equivalent in Python because the parameter "modulus" present in the code builder in JavaScript, which I did not find in Python-RSA library .
I need to rewrite the JS code or is there some simpler alternative?
Both private and public keys contain the modulus n . The public key contains the modulus and the encryption (public) exponent e , the private key contains the modulus and the decryption (private) exponent d .
So what you have to do is to simply extract the three values n, d, e from the keys. Presumably, the python module does that itself.
On how to find the modulus: https://crypto.stackexchange.com/questions/18031/the-modulus-of-rsa-public-key
General explanation of RSA:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.