diff --git a/boot/boot.js b/boot/boot.js index 11286678d..99e00f6da 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -799,12 +799,13 @@ the password, and to encrypt/decrypt a block of text $tw.utils.Crypto = function() { var sjcl = $tw.node ? (global.sjcl || require("./sjcl.js")) : window.sjcl, currentPassword = null, - callSjcl = function(method,inputText,password) { + callSjcl = function(method,inputText,password,options) { + options = options || {}; password = password || currentPassword; var outputText; try { if(password) { - outputText = sjcl[method](password,inputText); + outputText = sjcl[method](password,inputText,options); } } catch(ex) { console.log("Crypto error:" + ex); @@ -830,7 +831,8 @@ $tw.utils.Crypto = function() { return !!currentPassword; } this.encrypt = function(text,password) { - return callSjcl("encrypt",text,password); + // set default ks:256 -- see: http://bitwiseshiftleft.github.io/sjcl/doc/convenience.js.html + return callSjcl("encrypt",text,password,{v:1,iter:10000,ks:256,ts:64,mode:"ccm",adata:"",cipher:"aes"}); }; this.decrypt = function(text,password) { return callSjcl("decrypt",text,password);