一、使用工具生成RSA非对称加密私钥和公钥
生成私钥
openssl genrsa -out my_private.key 2048
生成公钥
openssl rsa -in my_private.key -pubout -out my_public.key
用公钥加密
echo -n "password1!" | openssl rsautl -encrypt -pubin -inkey my_public.key -out encrypted.bin
用私钥解密
openssl rsautl -decrypt -inkey my_private.key -in encrypted.bin -out decrypted.txt