CryptDown – Client-side AES-encrypted Markdown pastes
cryptdown.eu
cryptdown.eu
and this is why we don't like crypto in the browser...
This implementation just so happens to not protect against it properly. There are legitimate arguments against client-side cryptography; this is not one of them.
[1] your browser
I might work on this if I get a little time later today, but in case I don't, here are a few resources for you:
http://stackoverflow.com/questions/3129899/what-are-the-comm...
https://www.owasp.org/index.php/XSS_%28Cross_Site_Scripting%...
The good news is that PHP is so widespread that there are really great tutorials and libraries for sanitizing user input and preventing cross-site scripting.
Good luck!
Is there anything new in your implementation, or is this just "me too"?
SHA256 is blazing fast. While this is a good thing for a hash function in general, it is not for a key derivation. PBKDF2, scrypt, bcrypt and others are slow by design to make an attack much harder.
http://blog.astrumfutura.com/2010/10/nanosecond-scale-remote...
// Get the hash and the encrypted text from the encrypted data
hash = substing(encryptedData, 0, 64);
encryptedText = substing(encryptedData, 64);
foreach password in PasswordDictionary {
if hash == HMAC(encryptedText, SHA256(password)) {
print "Password found: " + password;
// Decrypt the message
print "Message: " + AESDecrypt(encryptedText, password);
}
}
The loop will run fast, and you get a clear-text password as a result, which can decrypt the message. If you replace SHA256(password) with PBKDF2(password, 20000) the loop becomes insanely slower.I really like the markdown editor implementation, will look at how they are using medium-editor... I'm working on a similar implementation and was considering going side-by-side, but this actually looks/works better. I did write a sanitization utility[2] for such inputs, but hadn't yet completed the editor.
[1] http://caniuse.com/#feat=webworkers [2] https://www.npmjs.com/package/cc-text-utils
Your argument is invalid.
I'd personally love to see JS crypto libraries like CryptoJS, SJCL and Forge start implementing polyfills for WebCrypto. Even just using the getRandomValues method (which seems to be fairly stable across all modern browsers) for their PRNG implementations would result in a much more theoretically sound crypto library.
http://www.w3.org/TR/WebCryptoAPI/
https://github.com/digitalbazaar/forge
My project is here:
github.com/xmnr/kopycat
It boasts a single user right now, so it shouldn't burden you with traffic too much.
*lose