Saturday, 24 August 2013

Short message encryption with only javascript to generate it in a URL

Short message encryption with only javascript to generate it in a URL

I'd like to present an idea to you that I think might help the privacy of
the average user. I would appreciate any comment or suggestion on this.
I've been struggling for quite some time now with the need for a simple
tool that I could share and use with my contacts who are only average
users and not familiar at all with any cryptographic technology or the
current tools available.
I'm planning to create a solution where one can easily encrypt a text
message or a file with a single password and send it in email or chat or
through whatever channel to somebody else. The solution should be entirely
platform independent and usable without the need to install any extra
softwares.
There are some text encryption websites out there that run client side
encryption from JavaScript entirely. I find this approach currently the
only possible solution. Also, there are libs for JS that already implement
encryption:
http://crypto.stanford.edu/sjcl/ http://code.google.com/p/crypto-js/
Though the mentioned approaches store the message on their server,
requiring you and your contact to trust it entirely. Because the server
might present a different JS code to the user when visiting it after he
gets the message by steeling the password and so revealing the secret.
While many think that it's not a good idea to do anything regarding
cryptographic tasks in JS, I believe there is a need for a tool that is
really platform independent (can be used on any tablet or PC) and still
incredibly easy to use. The idea behind this is that I believe something
is better than nothing. Sending information in plain text in email for
decades with our current technology is wrong in most cases. There are
times when we do need to share sensitive info via email and the other side
might have any kind of system.
I intend to avoid the use of public key cryptography for the following
reasons: - it is very complicated to setup including the signing of each
others' keys - complicated to use it - the user can loose his keys - most
of the time it needs and external software to be used and installed too -
a single password can be easily shared personally one time with my contact
and he or she can keep it written on a paper wherever
The solution I came up with could be the following:
First of all, the browser and the operating system under it sould be
considered trusted.
There would be a static index.html page with embedded JavaScript. The page
shows a textarea for the message and a textbox for the password. When
hitting enter, the JS code generates a URL that itself will contain the
encrypted message in base64 encoding. After digging I figured that 2000
bytes can be used for URLs just fine in every cases, so 1600 or 800
characters could be enough for short messages. This still needs planning.
So the encrypted message would travel with the URL. The website serving
the index.html would of course use SSL with a valid certificate. While it
seems an easy taks, of course it is not. The JS implementation should be
carefully created to avoid easy attacks on it.
(URL shortener services could be used for it too).
Also, the question stands: How can I make sure that my contact can be
certain about the origin of my message?
Well, the other side has to check if the domain is correct. Beside this,
the implementation must avoid the rest of the attacks. If the URL gets
changed during the travel of the email, then maximum the other side won't
be able to decode the message with the password. That's what I believe.
That it can be implemented this way.
About the file sharing. The solution should have a possibility to browse
for a file, then encrypt it, then put it out for download to the user.
This is just for him to be able to create the encrypted form of the file
without the need for external tools. Then he could upload it to the cloud
of his choice wherever (Google drive, Skydrive etc) and use that link in
the URL of the JS solution to send it to his contact.
So if another link travels with the link, then the file from the remote
host gets downloaded, decrypted and sent for download. All in his browser.
If it's an encrypted message in base64 form, then it gets printed on the
page after decryption (by the user providing his password of course).
Pros compared to other solutions: - no need to implement a storage because
no message nor file will be stored on the server, so the big players'
services could be used - therefore no need to reimplement the wheel
regarding the storage question - no need to trust a 3rd party because the
server could easily be ours because it would be extremely easy to set up
and serve it - easy with even a free provider to host the static
index.html - because of its simplicity, the server can be hardened much
better - easy to encrypt with it in practice - if one needs it, he could
use the index.html by clicking on it from his desktop too, but that's not
part of the original idea
My questions to you all are:
Do you find any flaw in my theory above? Could this really serve the
average people by providing a usable tool for them that is more than
nothing in times when they do need to send sensitive info to others?
Or does anything like that exist yet? Are there any better approaches?
Different technology maybe?
Thank You.

No comments:

Post a Comment