diff options
-rw-r--r-- | js/crypto.js | 47 | ||||
-rw-r--r-- | view/php/theme_init.php | 2 |
2 files changed, 42 insertions, 7 deletions
diff --git a/js/crypto.js b/js/crypto.js index 50282d18f..a7b278537 100644 --- a/js/crypto.js +++ b/js/crypto.js @@ -48,18 +48,43 @@ function red_encrypt(alg, elem,text) { if((alg == 'rot13') || (alg == 'triple-rot13')) newdiv = "[crypt alg='rot13']" + str_rot13(text) + '[/crypt]'; - else if(alg == 'aes256') { - // This is the prompt we're going to use when the receiver tries to open it. - // Maybe "Grandma's maiden name" or "our secret place" or something. + if(alg == 'aes256') { + + // This is the prompt we're going to use when the receiver tries to open it. + // Maybe "Grandma's maiden name" or "our secret place" or something. + + var enc_hint = prompt(aStr['passhint']); + + enc_text = CryptoJS.AES.encrypt(text,enc_key); + + encrypted = enc_text.toString(); + + newdiv = "[crypt alg='aes256' hint='" + enc_hint + "']" + encrypted + '[/crypt]'; + } + if(alg == 'rabbit') { + + // This is the prompt we're going to use when the receiver tries to open it. + // Maybe "Grandma's maiden name" or "our secret place" or something. - var enc_hint = prompt(aStr['passhint']); + var enc_hint = prompt(aStr['passhint']); - enc_text = CryptoJS.AES.encrypt(text,enc_key); + enc_text = CryptoJS.Rabbit.encrypt(text,enc_key); + encrypted = enc_text.toString(); - encrypted = enc_text.toString(); + newdiv = "[crypt alg='rabbit' hint='" + enc_hint + "']" + encrypted + '[/crypt]'; + } + if(alg == '3des') { + + // This is the prompt we're going to use when the receiver tries to open it. + // Maybe "Grandma's maiden name" or "our secret place" or something. + + var enc_hint = prompt(aStr['passhint']); + + enc_text = CryptoJS.TripleDES.encrypt(text,enc_key); + encrypted = enc_text.toString(); - newdiv = "[crypt alg='aes256' hint='" + enc_hint + "']" + encrypted + '[/crypt]'; + newdiv = "[crypt alg='3des' hint='" + enc_hint + "']" + encrypted + '[/crypt]'; } enc_key = ''; @@ -102,6 +127,14 @@ function red_decrypt(alg,hint,text,elem) { var enc_key = prompt((hint.length) ? hint : aStr['passphrase']); enc_text = CryptoJS.AES.decrypt(text,enc_key); } + if(alg == 'rabbit') { + var enc_key = prompt((hint.length) ? hint : aStr['passphrase']); + enc_text = CryptoJS.Rabbit.decrypt(text,enc_key); + } + if(alg == '3des') { + var enc_key = prompt((hint.length) ? hint : aStr['passphrase']); + enc_text = CryptoJS.TripleDES.decrypt(text,enc_key); + } enc_key = ''; diff --git a/view/php/theme_init.php b/view/php/theme_init.php index ab28180f2..0867c989d 100644 --- a/view/php/theme_init.php +++ b/view/php/theme_init.php @@ -27,6 +27,8 @@ head_add_js('library/jgrowl/jquery.jgrowl_minimized.js'); head_add_js('library/tinymce/jscripts/tiny_mce/tiny_mce_src.js'); head_add_js('library/cryptojs/components/core-min.js'); head_add_js('library/cryptojs/rollups/aes.js'); +head_add_js('library/cryptojs/rollups/rabbit.js'); +head_add_js('library/cryptojs/rollups/tripledes.js'); head_add_js('js/acl.js'); head_add_js('js/webtoolkit.base64.js'); head_add_js('js/main.js'); |