by cryptbe · 12y ago · 0 comments
I want to introduce many useful applications of Javascript crypto that I've seen, and I want to explain that developing crypto in Javascript is difficult because of the lack of types. What I found surprisingly is that most people that complain about Javascript crypto don't even mention this problem. I guess they think the language is too bad to even give it a try.
Think about what you'd do if you were going to install TrueCrypt or some other security/cryptography program. Assuming you didn't want to build it from the source, you'd download a binary, and that binary would have an SHA or MD5 hash next to it, verifying that it's the correct file. Other people who compile the binary from source should be able to generate the same file and compare the hashes, so at the very least it can be audited and you can verify that you've got what they say you have. To do the equivalent thing with in-browser Javascript, you'd need to check the MD5 hash of the javascript that you're executing every single time you use the script, BEFORE you start the encryption/decryption process. You could use some sort of browser extension to check that the script you're about to download and execute is the same one you've used before, but if you're already installing browser extensions to do something like that, you might as well just install a browser extension that does the crypto for you without having a trust relationship with a server.