I want to be able to generate and generate the same RSA keys from a password (and salt) only in python .
I am currently doing this using pycrypto, however it does not seem to generate the exact same exact password keys only. The reason is that when pycrypto generates an RSA key, it uses some kind of random number inside.
Currently my code is as follows:
import DarkCloudCryptoLib as dcCryptoLib
I don't care if pycrypto should be used as long as I can only generate these RSA keys from passwords and salts.
Thanks for the help in advance.
Just for reference, here is what the dcCryptoLib.equalRSAKeys (key1, key2) function looks like:
def equalRSAKeys(rsaKey1, rsaKey2): public_key = rsaKey1.publickey().exportKey("DER") private_key = rsaKey1.exportKey("DER") pub_new_key = rsaKey2.publickey().exportKey("DER") pri_new_key = rsaKey2.exportKey("DER") boolprivate = (private_key == pri_new_key) boolpublic = (public_key == pub_new_key) return (boolprivate and boolpublic)
NOTE. In addition, I use only RSA for authentication. Thus, any solution that provides a way to create secure asymmetric signatures / verifications generated by passwords is an acceptable solution for my application. Although generating RSA keys from passwords that I feel is a question that should also be answered, as it seems useful when used correctly.
source share