简体   繁体   中英

phpseclib encryption using RSA with manual encryption

I am trying to encrypt a plaintext string in RSA using phpseclib0.3.5.

My problem is I am trying to get rid of random padding and make it so I can manually set it. I know this is bad for security reasons, but it must be done. We are conducting a password study, and do not want to store the private key on the server. We will just be encrypting with the public key and comparing ciphertexts to test a login. Therefore, for the same plaintext, the ciphertexts must be the same everytime they are generated.

Hopefully somebody knows how to do this. I have been trying to sift through the phpseclib code but it is not friendly.

Thanks

I think you are using the wrong tools. If you want to use comparison to check if the right password is given, you should use hash functions like SHA-2 instead of public key encryption. You can do the latter in addition if for some reason you need to recover the passwords (usually a bad idea in production, but maybe useful for your setting)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM