The business scenario is very simple:
Enter the password at the front end, which is encrypted and transmitted to the background, and used after decryption.
The first step is to generate a key, see http://blog.csdn.net/gengxiaoming7/article/details/78505107
I only use the first two commands
openssl genrsa -out rsa_private.key 2048
openssl rsa -in rsa_private.key -pubout -out rsa_public.key
The front end should be encrypted with js, and used to
https://github.com/rzcoder/node-rsa
This is used in the webpack environment
https://github.com/ziyan/javascript-rsa
This is used in the general web, directly importing js files
Backend uses php
$prikeyid = openssl_get_privatekey($private_key);
openssl_private_decrypt(base64_decode($cipher_text), $decrypted, $prikeyid));
echo $decrypted;