简体   繁体   English

RSA用Javascript加密并用Java解密-没有SSL

[英]RSA encrypt in Javascript and decrypt in Java - NO SSL

I have written a java utility for key pair generation for RSA encryption. 我已经编写了一个Java实用程序来生成用于RSA加密的密钥对。 But to encrypt the password, I have to do it in client side javascript 但是要加密密码,我必须在客户端javascript中进行

Does anyone has a sample code to do that in javascript? 有没有人有示例代码可以在javascript中执行此操作? Where I can just pass the public key and the password (string) and get the encrypted password back ? 在哪里我可以传递公钥和密码(字符串)并取回加密的密码? Badly need this. 急需这个。

I tried jCryption and http://www.ohdave.com/rsa/ but couldn't make much out of it. 我尝试了jCryption和http://www.ohdave.com/rsa/,但做得并不多。 :( :(

The application doesn't have SSL. 该应用程序没有SSL。 Any other secure encryption method/procedure/library will be most welcome. 任何其他安全的加密方法/过程/库都将受到欢迎。

I have used bits of this beginning implementation of C# in javascript for other pieces and seen correct results. 我已经在javascript中使用了C#的这种初始实现的其他部分,并看到了正确的结果。 It does have RSA already. 它确实已经有了RSA。

http://www.codeproject.com/KB/tips/JocysComJavaScriptClasses.aspx http://www.codeproject.com/KB/tips/JocysComJavaScriptClasses.aspx

You can instantiate it the same as C# calls (for the most part). 您可以将其实例化为C#调用(大部分情况下)。 Since you have JAVA experience, it shouldn't be a large learning curve. 既然您具有JAVA经验,那么学习时间就不算多了。

I don't know if it's required for the RSA, but on some functions I've used; 我不知道RSA是否需要它,但是我已经使用了某些功能。 you have to convert to a binary array before using a portion to get the right example. 您必须先转换为二进制数组,然后再使用一部分获取正确的示例。 (Such as the MD5 or SHA1) (例如MD5或SHA1)

Hope that helps. 希望能有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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