Is there any way that i can (securely, base64 ruled out) encrypt data in javascript without using encryption keys. I know its unlikely, because my encryption engine would be available, but does anyone know of any method that can be used
EDIT:
Upon request, i am trying to hide data that a user entered into a textbox before it gets submitted. The data is completely random and the user will never be asked to write it again. Its not a password, its essentially like a post
-
2Once JavaScript code hits the client, it can be read. So even if you encrypt it, I can see that code and decrypt it myself.gen_Eric– gen_Eric2013年01月08日 16:31:20 +00:00Commented Jan 8, 2013 at 16:31
-
Generally not possible. But depending on your scenario there might be something you can do. For example if you want to encrypt user password for authentication, then it is enough to hash it. And revealing hashing algorithm means nothing, because of the way hashing functions work.freakish– freakish2013年01月08日 16:33:39 +00:00Commented Jan 8, 2013 at 16:33
-
Are you talking about captcha? Then you should send an image with a random database ID. I'm not sure where's the problem. Maybe you should explain it more, because you might not have to use any encryption at all.freakish– freakish2013年01月08日 16:54:17 +00:00Commented Jan 8, 2013 at 16:54
-
No. The user posts something random that doesn't exist in a databaseuser1310420– user13104202013年01月08日 16:58:20 +00:00Commented Jan 8, 2013 at 16:58
-
1OK, if it is essentially like a post, then why is security an issue here? You have to give us more details.freakish– freakish2013年01月08日 16:59:43 +00:00Commented Jan 8, 2013 at 16:59
3 Answers 3
No.
You need keys for encryption to be secure.
If you don't have keys then either nobody can unlock it or everybody can.
4 Comments
I think it would be more helpful if you explained what you were trying to accomplish. What are you trying to protect? Who are you trying to protect it from? Where are you sending the data?
If you are trying to hide something from the client, encrypting it on the clients machine means you would never be truly secure.
If you are trying to have the client send encrypted data to a server of yours, why not just use SSL? This is far easier.
Comments
Why not HTTPS?
What's the source of the data and where is it going? What's the difficulty of using keys? Again, why not HTTPS?
NEVER trust client-side data! ALWAYS presume can be deleted anytime and user can access and edit it anytime.