add rabbit and tripledes ciphers - probably need a pconfig to set the default

This commit is contained in:
friendica 2013-11-11 18:31:34 -08:00
parent 54438be7c2
commit 58e0d58489
2 changed files with 42 additions and 7 deletions

View File

@ -48,7 +48,8 @@ function red_encrypt(alg, elem,text) {
if((alg == 'rot13') || (alg == 'triple-rot13'))
newdiv = "[crypt alg='rot13']" + str_rot13(text) + '[/crypt]';
else if(alg == 'aes256') {
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.
@ -61,6 +62,30 @@ function red_encrypt(alg, elem,text) {
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']);
enc_text = CryptoJS.Rabbit.encrypt(text,enc_key);
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='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 = '';

View File

@ -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');