问题描述
有没有办法使用javascript生成私钥和公钥?
Is there a way to generate both private and public keys using javascript?
我需要在数据库中使用那些密钥。
And I need to those key in a database.
----- BEGIN RSA私钥----- MIICXQIBAAKBgQDlOJu6TyygqxfWT7eLtGDwajtNFOb9I5XRb6khyfD1Yt3YiCgQ
WMNW649887VGJiGr / L5i2osbl8C9 + WJTeucF + S76xFxdU6jE0NQ + Z + zEdhUTooNR
aY5nZiu5PgDB0ED / ZKBUSLKL7eibMxZtMlUDHjm4gwQco1KRMDSmXSMkDwIDAQAB
AoGAfY9LpnuWK5Bs50UVep5c93SJdUi82u7yMx4iHFMc / Z2hfenfYEzu + 57fI4fv
XTQ // 5DbzRR / XKb8ulNv6 + CHyPF31xk7YOBfkGI8qjLoq06V + FyBfDSwL8KbLyeH
m7KUZnLNQbk8yGLzB3iYKkRHlmUanQGaNMIJziWOkN + N9dECQQD0ONYRNZeuM8zd
8XJTSdcIX4a3gy3GGCJxOzv16XHxD03GW6UNLmfPwenKu + cdrQeaqEixrCejXdAF
Z / 7 + BSMpAkEA8EaSOeP5Xr3ZrbiKzi6TGMwHMvC7HdJxaBJbVRfApFrE0 / mPwmP5
rN7QwjrMY + 0 + + AbXcm8mRQyQ1 IGEembsdwJBAN6az8Rv7QnD / YBvi52POIlRSSIM
V7SwWvSK4WSMnGb1ZBbhgdg57DXaspcwHsFV7hByQ5BvMtIduHcT14ECfcECQATe
aTgjFnqE / lQ22Rk0eGaYO80cc643BXVGafNfd9fcvwBMnk0iGX0XRsOozVt5Azil
psLB YuApa66NcVHJpCECQQDTjI2AQhFc1yRnCU / YgDnSpJVm1nASoRUnU8Jfm3Oz
uku7JUXcVpt08DFSceCEX9unCuMcT72rAQlLpdZir876
----- END RSA PRIVATE KEY -----
----- BEGIN PUBLIC KEY- ---- MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlOJu6TyygqxfWT7eLtGDwajtN
FOb9I5XRb6khyfD1Yt3YiCgQWMNW649887VGJiGr / L5i2osbl8C9 + WJTeucF + S76
xFxdU6jE0NQ + Z + zEdhUTooNRaY5nZiu5PgDB0ED / ZKBUSLKL7eibMxZtMlUDHjm4
gwQco1KRMDSmXSMkDwIDAQAB
----- END PUBLIC KEY -----
-----BEGIN PUBLIC KEY----- MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlOJu6TyygqxfWT7eLtGDwajtN FOb9I5XRb6khyfD1Yt3YiCgQWMNW649887VGJiGr/L5i2osbl8C9+WJTeucF+S76 xFxdU6jE0NQ+Z+zEdhUTooNRaY5nZiu5PgDB0ED/ZKBUSLKL7eibMxZtMlUDHjm4 gwQco1KRMDSmXSMkDwIDAQAB -----END PUBLIC KEY-----
谢谢!
推荐答案
检查
如果你要将密钥保存到数据库中,那么使用像nodejs这样的服务器来看这个服务器端是值得的。
If you are saving the keys to a database anyway it could be worth your while looking at doing this server side using something like nodejs
看看图书馆没有在一段时间内更新,因此可能值得搜索。
Have a look here https://github.com/juliangruber/keypair that library hasn't been updated in some time so it may be worth a search.
这篇关于使用javascript生成RSA密钥?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!