RSA 加密 Javascript
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17685645/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
RSA Encryption Javascript
提问by sputn1k
can anyone please help me with this, i have been instructed to write an application that takes some DATA then Encrypts it with a RSA Public Key and apparently needs to be RSA Encryption(i have never heard or seen this before)?
任何人都可以帮我解决这个问题吗,我被指示编写一个应用程序,该应用程序需要一些数据,然后用 RSA 公钥对其进行加密,显然需要是 RSA 加密(我以前从未听说过或见过这个)?
Which encryption cipher is RSA meant to use as standard?
RSA 打算使用哪种加密密码作为标准?
var key = "TUlHZE1BMEdDU3FHU0liM0RRRUJBUVVBQTRHTEFEQ0Jod0tCZ1FDbVFiTWc3SWRpeHVmYWEwcDd2ODVLVytmUnVlZ216UUhibnNoWjhmbXlTQW9MMXRFVzAyNEZKVFlSTFZxN0VsV2p1R0U4aHQ3RmJjN1NURWpxZVViWU5xdnRiVWN6UFZYSE5FdStYRUVndGszazlFNXVQWG0wVzRIc3RtK0FhRXcyMmxxb2lFNGlrT1QzZzdPRXNHSVFCMVNlSlRtVTE1eFBBZ3M3SXRjTVFRSUJFUT09";
var data = "Xa21dr";
回答by sputn1k
Never mind found the answer myself!
没关系,我自己找到了答案!
RSA Encryption standard uses PKCS #1
RSA 加密标准使用 PKCS #1
Best library to use is pidCrypt, nothing else worked for me!
最好使用的库是 pidCrypt,没有其他东西对我有用!
https://sourceforge.net/projects/pidcrypt/
https://sourceforge.net/projects/pidcrypt/
the idiots on the other end failed to let me know that that RSA Public Key was meant to be base64 decoded too before encrypting the DATA before sending.
另一端的白痴未能让我知道 RSA 公钥在发送之前加密数据之前也应该进行 base64 解码。
回答by dlongley
You may be interested in trying out forge (it does RSA and more). There are lots of examples on the README:
您可能有兴趣尝试伪造(它可以使用 RSA 等)。README 上有很多例子: