|
|
|
@ -8,6 +8,14 @@ function showHideMenu()
|
|
|
|
|
doc.className = "hidden-by-default";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function truncateCryptFields(){
|
|
|
|
|
getEncFieldsListIntegers().forEach( element=> {
|
|
|
|
|
document.getElementById("form_crypt_" + element).value = "";
|
|
|
|
|
});
|
|
|
|
|
getEncFieldsListStrings().forEach( element=> {
|
|
|
|
|
document.getElementById("form_crypt_" + element).value = "";
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
function getEncFieldsListStrings(){
|
|
|
|
|
return ['iv','mode','adata','cipher','salt'];
|
|
|
|
|
}
|
|
|
|
@ -29,14 +37,7 @@ function crypt()
|
|
|
|
|
|
|
|
|
|
document.getElementById("form_content").value = enc["ct"];
|
|
|
|
|
}
|
|
|
|
|
function truncateCryptFields(){
|
|
|
|
|
getEncFieldsListIntegers().forEach( element=> {
|
|
|
|
|
document.getElementById("form_crypt_" + element).value = "";
|
|
|
|
|
});
|
|
|
|
|
getEncFieldsListStrings().forEach( element=> {
|
|
|
|
|
document.getElementById("form_crypt_" + element).value = "";
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function uncrypt()
|
|
|
|
@ -58,6 +59,7 @@ function uncrypt()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
|
|
|
|
|
|
var clearTxt = sjcl.decrypt(key,JSON.stringify(encArr));
|
|
|
|
|
document.getElementById("form_content").value = clearTxt;
|
|
|
|
|
truncateCryptFields();
|
|
|
|
@ -67,8 +69,15 @@ function uncrypt()
|
|
|
|
|
alert("Le pad n'a pas pu être déchiffré.");
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
var clearTxt = sjcl.decrypt(key,document.getElementById("content").innerHTML);
|
|
|
|
|
document.getElementById("content").innerHTML = clearTxt;
|
|
|
|
|
sjclArr["ct"] = document.getElementById("content").innerHTML;
|
|
|
|
|
try{
|
|
|
|
|
var clearTxt = sjcl.decrypt(key,JSON.stringify(sjclArr));
|
|
|
|
|
document.getElementById("content").innerHTML = clearTxt;
|
|
|
|
|
}
|
|
|
|
|
catch(error)
|
|
|
|
|
{
|
|
|
|
|
alert("Le pad n'a pas pu être déchiffré.");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function ready(){
|
|
|
|
|