Encrypting data in Javascript

2019-08-01 23:08发布

问题:

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

回答1:

No.

You need keys for encryption to be secure.

If you don't have keys then either nobody can unlock it or everybody can.



回答2:

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.



回答3:

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.