var EncryptStorage=function(err_code){this.__err_code=err_code};EncryptStorage.prototype={EncryptItem:function(symmAlgo,symmKey,symmIV,item){if(!symmAlgo||!symmKey||!symmIV||!item){var err={};err.code=this.__err_code.ERROR_PARAMETER_VALUE_IS_NULL;err.message="[LocalStorage EncryptItem Failed] the parameter value cannot be null.";err.detail=null;throw err;}var cipher=null;try{if("3des"===symmAlgo)symmAlgo="des";cipher=crosscert.cipher.algorithms[symmAlgo].startEncrypting(symmKey,symmIV);cipher.update(crosscert.util.createBuffer(item));cipher.finish()}catch(e){var err={};err.code=this.__err_code.ERROR_JSUSTOOLKIT;err.message="[LocalStorage EncryptItem Failed][TOOLKIT ERROR] during encrypting item.";err.detail="error code : "+e.code+"\nerror message : "+e.message;throw err;}return cipher.output.getBytes()},DecryptItem:function(symmAlgo,symmKey,symmIV,item){if(!symmAlgo||!symmKey||!symmIV||!item){var err={};err.code=this.__err_code.ERROR_PARAMETER_VALUE_IS_NULL;err.message="[LocalStorage DecryptItem Failed] the parameter value cannot be null.";err.detail=null;throw err;}var cipher=null;try{if("3des"===symmAlgo)symmAlgo="des";cipher=crosscert.cipher.algorithms[symmAlgo].startDecrypting(symmKey,symmIV);cipher.update(crosscert.util.createBuffer(item));cipher.finish()}catch(e){var err={};err.code=this.__err_code.ERROR_JSUSTOOLKIT;err.message="[LocalStorage DecryptItem Failed][TOOLKIT ERROR] during decrypting item.";err.detail="error code : "+e.code+"\nerror message : "+e.message;throw err;}return cipher.output.getBytes()},MakeKey:function(src,symmAlgo,hashAlgo){if(!src||!symmAlgo||!hashAlgo){var err={};err.code=this.__err_code.ERROR_PARAMETER_VALUE_IS_NULL;err.message="[LocalStorage MakeKey Failed] the parameter value cannot be null.";err.detail=null;throw err;}var md,dk,key,iv,id,rv,rv2,rv3;md=key=iv=id=rv=rv2=rv3=null;try{md=crosscert.md.algorithms[hashAlgo].create();md.start();md.update(src);rv=md.digest().getBytes();md.update(rv);rv2=md.digest().getBytes();md.update(rv2);rv3=md.digest().getBytes()}catch(e){var err={};err.code=this.__err_code.ERROR_JSUSTOOLKIT;err.message="[LocalStorage MakeKey Failed][TOOLKIT ERROR] during hashing data.";err.detail="error code : "+e.code+"\nerror message : "+e.message;throw err;}try{dk=crosscert.pkcs5.pbkdf2(src,rv,2048,32)}catch(e$0){var err={};err.code=this.__err_code.ERROR_JSUSTOOLKIT;err.message="[LocalStorage MakeKey Failed][TOOLKIT ERROR] during key derivation.";err.detail="error code : "+e$0.code+"\nerror message : "+e$0.message;throw err;}if("3des"===symmAlgo){key=dk.slice(0,24);iv=rv2.slice(0,8);id=rv3}else{key=dk.slice(0,16);iv=rv2.slice(0,16);id=rv3}return{"id":id,"key":key,"iv":iv}}};