1. 程式人生 > >JavaScript RSA加密庫Cryptico.js

JavaScript RSA加密庫Cryptico.js

轉自:http://www.open-open.com/news/view/27cfef

Cryptico.js 是一個易於使用的JavaScript工具包用於在客戶端對文字進行加密。

它支援RSA + AES方法,任意位元組長度(228, 1024等)的文字都可以進行加密。 Cryptico.js

內容使用一個公鑰進行加密,並且只能用這個金鑰進行解密。
Cryptico.js 沒有依賴任何JS框架進行開發,擁有良好的文件。

1 // The passphrase used to repeatably generate this RSA key.
2 var PassPhrase = "The Moon is a Harsh Mistress."
;
3
4 // The length of the RSA key, in bits.
5 var Bits = 1024;
6
7 var MattsRSAkey = cryptico.generateRSAKey(PassPhrase, Bits);
1 var PlainText = "Matt, I need you to help me with my Starcraft strategy.";
2
3 var EncryptionResult = cryptico.encrypt(PlainText, MattsPublicKeyString);