I know I don't want to trust myself to keep anyone else's secrets, so I want the data to be encrypted in a browser.
I found out quite pretty javascript crypto library: Stanford Javascript Crypto Library
And as a proof of concept, I could get this working in IE.
function encryptElement(eTarget)
{
$(eTarget).text(sjcl.encrypt("password", $(eTarget).text()));
$(eTarget).addClass("enc");
}
function decryptElements()
{
$(".enc").each(
function (idx)
{
if ($(this).text())
{
$(this).text(sjcl.decrypt("password", $(this).text()));
$(this).removeClass("enc");
}
}
);
}
decryptElements();
However, everything breaks in Chrome, because, despite the encryptElement function is called, the data is submitted as it was before the encryption. Also, ScriptManager.RegisterStartupScript, doesn't seem to work as expected in Chrome, so I never get my decryptElements function called after the UpdatePanel is updated.
I am pretty tired of all these browser quirks. The client scripting is so fragile it really freaks me out.
No comments:
Post a Comment