Wouldn't it make more sense to revive FireGPG[1] and, while you're at it, port it to all other major browsers?
I am still disappointed that PGP in the browser never gained traction. Not only would it help with e-mail security, it could also be used for passwordless website logins, portable web identities, all that jazz[2].
One proper, user-friendly browser plugin could put an end to all those nasty kludges called OAuth, OpenID, LastPass, etc...
I'm currently working on this. So far, recognition of encrypted text and decryption works fine. However, it breaks Gmail if the text is part of an email there - only reloading get's it to work again.
The plugin I'm using was compiled on Ubuntu x64 and probably doesn't work anywhere else. It was written using firebreath, basically it's just a wrapper to gpg.
Your key derivation function is pretty weak. Looking at your code you are doing SHA256(password entered by user). You should take a look at using http://en.wikipedia.org/wiki/PBKDF2 for the key derivation. SHA256 is really fast and given that you are getting entropy from some user entered password (which is likely to be badly chosen) you want something _slow_ to derive the key. Hence PBKDF2 with lots of iterations.
Thank you point me out. Definitely, I need to implement PBKDF2 (and add salt to password). I planning this, but weekend is too short and finally I just put SHA256 for key derivation.
But, until you describe, I do not recognize what the principal difference between hash and password based key derivation function, thanks.
He'd also need to HTTPS all the scripts that script requires, and devise some way to ensure that the script was never called from a page that itself included any HTML or JS over a non-HTTPS connection, because any of those document loads could also MITM the script. Isn't Javascript crypto fun!
Yes, I will install ssl cert in future (at least self signed), understand the risk. Standalone bookmark is great idea, but I am not sure if I can fit script to 2048 bytes. Maybe, I'll make html5 cache manifest to avoid network access.
While I won't point out the technical reasons why encryption is hard, I will say that I think this project is cool.
I think encryption is something more people might use if it were accessible.
But it's hard enough as it is without making it so easy that Joe Sixpack could use it -- especially since implementations as we know it require Joe Sixpack to understand what he's doing or else the encryption fails.
However, tools like this at least give us prototypes for ideas that could one-day bridge the gap.
Good job, dude. Hope you stick with it and find a way to make it better.
Note that Gmail automatically saves your draft as you type it. So while this will offer some protection for the message while it's in transit from Google's server to your destination, your unencrypted message draft will still be sent to Google's servers (and given Google Apps' distributed architecture, I'm not sure you can determine where that unencrypted copy could end up or when it'd be erased).
Perhaps a way around that could be to enhance a text input field so that only the final encrypted message is written to it, so Google's app does not see the plain text.
I feel like this would be better as a browser extension instead of a bookmarklet... I get a bit queasy about the potential for MITM with this implementation. An extension that could bring GPG to the mix, would be VERY awesome (if that doesn't exist, I actually haven't tried searching for that...).
Who are you protecting the message from when you do this? Gmail? But they can just send the cleartext to the server before you click "encrypt it", and in fact they do (drafts).
Don't type stuff into a program you didn't write if you don't want the author to see it.
This is great, I was just thinking the other day that it should be possible to encrypt gmail messages. Now you should make it possible to encrypt GChat messages automatically when I hit Send, and then decrypt them when they are received, that way they are encrypted end to end, instead of just between my browser and the server :-)
This implementation is broken. It concatenates a hash of the plaintext to a CTR-mode ciphertext. That's weakly authenticated and leaks information about the plaintext.
It would be better to HMAC the ciphertext with a second key value.
I'm pretty amateur on cryptography, and this is cool and everything for basic security, but for those more in the know does the fact that the algorithm knows a password is "wrong" weaken the cryptography (I realise it's a cool feature of this app, I'm talking generally)? Presumably you would have to test each decrypted result for language words etc. otherwise to know if you had decrypted it correctly.
Sure, but on modern browsers only (utilizing html5 file API). I am thinking about implementing RSA private key generation and online public key registry in future.
Hmm, testing it out it constantly confuses weather it should be encrypting or decrypting. I've tried to enter a message and had it request a decryption password.
That combined with the poor crypto practices makes it rather unusable, but it's a fantastic concept! Just needs a bit of work.
This is an awesome way of doing things. I'm going to be doing a slightly different implementation of this for my WIRE project on the advice of a bunch of people (more intense key differentiation, for a start), but it's good to know people are starting to do this :)
[+] [-] moe|15 years ago|reply
I am still disappointed that PGP in the browser never gained traction. Not only would it help with e-mail security, it could also be used for passwordless website logins, portable web identities, all that jazz[2].
One proper, user-friendly browser plugin could put an end to all those nasty kludges called OAuth, OpenID, LastPass, etc...
[1] http://getfiregpg.org/s/home
[2] http://en.wikipedia.org/wiki/Web_of_trust
[+] [-] Inufu|15 years ago|reply
Since I have zero experience with JS, I'm thankful for any help. Code is on: https://github.com/Mononofu/CryptoChrome
The plugin I'm using was compiled on Ubuntu x64 and probably doesn't work anywhere else. It was written using firebreath, basically it's just a wrapper to gpg.
[+] [-] IgorPartola|15 years ago|reply
[+] [-] jgrahamc|15 years ago|reply
[+] [-] eran|15 years ago|reply
[+] [-] eran|14 years ago|reply
[+] [-] pixdamix|15 years ago|reply
Besides that, this is pretty cool. Could you provide a standalone bookmarlet which doesn't need to download any scripts ?
[+] [-] tptacek|15 years ago|reply
[+] [-] eran|15 years ago|reply
[+] [-] eran|15 years ago|reply
[+] [-] agentultra|15 years ago|reply
I think encryption is something more people might use if it were accessible.
But it's hard enough as it is without making it so easy that Joe Sixpack could use it -- especially since implementations as we know it require Joe Sixpack to understand what he's doing or else the encryption fails.
However, tools like this at least give us prototypes for ideas that could one-day bridge the gap.
Good job, dude. Hope you stick with it and find a way to make it better.
[+] [-] Shenglong|15 years ago|reply
[+] [-] Erwin|15 years ago|reply
Perhaps a way around that could be to enhance a text input field so that only the final encrypted message is written to it, so Google's app does not see the plain text.
[+] [-] niels_olson|15 years ago|reply
[+] [-] Ixiaus|15 years ago|reply
Cool project though :)
[+] [-] jrockway|15 years ago|reply
Don't type stuff into a program you didn't write if you don't want the author to see it.
[+] [-] woodall|15 years ago|reply
>encryption
Choose one.
[+] [-] hollerith|15 years ago|reply
[+] [-] VMG|15 years ago|reply
Typing The Letters A-E-S Into Your Code? You’re Doing It Wrong
[+] [-] megamark16|15 years ago|reply
[+] [-] evanw|15 years ago|reply
http://pidgin-encrypt.sourceforge.net/
[+] [-] mkelly|15 years ago|reply
[+] [-] zitterbewegung|15 years ago|reply
[+] [-] eran|15 years ago|reply
[+] [-] sweis|14 years ago|reply
It would be better to HMAC the ciphertext with a second key value.
[+] [-] eran|14 years ago|reply
[+] [-] drdaeman|15 years ago|reply
[+] [-] scrrr|15 years ago|reply
[+] [-] Inufu|15 years ago|reply
[+] [-] js4all|15 years ago|reply
I am not sure though, if it is possible to create a multipart message using JavaScript in gmail.
[+] [-] nopassrecover|14 years ago|reply
[+] [-] yan|14 years ago|reply
[+] [-] e-dard|15 years ago|reply
[+] [-] eran|15 years ago|reply
[+] [-] mtogo|15 years ago|reply
That combined with the poor crypto practices makes it rather unusable, but it's a fantastic concept! Just needs a bit of work.
[+] [-] antihero|15 years ago|reply
[+] [-] antihero|14 years ago|reply
[+] [-] fduran|15 years ago|reply
I also created recently a weekend project based on client-side encryption: https://whisperpassword.com , I need to learn about design though ;-)