1
我正在尋找一個RSA JavaScript庫,用2048bits對消息進行編碼。作爲參數我有mod和exp。尋找JavaScript RSA Lib 2048bits
有什麼建議嗎?
http://ohdave.com/rsa/是非常非常慢...
基本上我只是想有從Java這幾行Javascript中工作
final BigInteger mod = new BigInteger("4466233205010763939741450753158843137124689955872516700870629048046288220560359265881151146540009255370538519849429733539445188287525631514301030537792870463475023632636041223554887103782248303563304443978457914857475908030765497628649778466179256664651");
final BigInteger exp = new BigInteger("23139601584407978251606203018538255044792155193454239408670287967705206387218929560404426270212009386707782396911651551942218161903546775202519839339061975116993987646645254223383869945314788199864108536397108982371342391228965940857509286281911085537664761189681228964354095011341945911798610297903277296935707197643500842487686588664503922028182768389581098745054341591421596765805353910748418759970760060122504351418627635922030816083629993980577802392293471805191132307965316768557540634864009685313523238948086384123273996765014668141916815067709883071065927377949234999779835469873986654327727461324511444935481");
Key key = KeyFactory.getInstance("RSA").generatePrivate(new RSAPrivateKeySpec(mod, exp));
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
cipher.init(Cipher.ENCRYPT_MODE, key);
byte[] signature = cipher.doFinal(sha1);
System.out.println(Arrays.toString(signature));
在「javascript cryptography」和類似搜索的「stackoverflow」上進行快速搜索可以發現一些答案,部分解釋了爲什麼這個想法完全有缺陷,並且部分引用了包括Javascript庫在內的各種解決方案。 –
特別參見http://stackoverflow.com/questions/4176574/javascript-cryptography-library-to-sign-form-data-in-browser –
另請參閱http://www.matasano.com/articles/javascript-密碼學/ – ntoskrnl