views:

32

answers:

2

Normally, if I complete a form, the data will be sent to the server as raw plain text which could be read by sniffers.

I want to encrypt form's data client-side (like username, password,...) and then send them to the server.

It seems that there are two ways:
1- Using SSL (in my scenarion, I can't use)
2- Using custom ActiveX control.
3- Using server side dynamic javascript encryption function.

Which one is better or any other solution?

A: 

Server-side encryption won't work, because it wouldn't solve the problem (plaintext data being transmitted from the client to the server). What you would need is a javascript implementation of an asymmetrical encryption algorithm. Something like RSA. The server can provide the client with the public key, which would be used to encrypt the form data before it's sent, and then can use the private key to decrypt the data after it's been received.

Mark
+1  A: 

If you can't use SSL, which is the only sane option here IMHO, you must use client-side public key encryption with javascript, because symmetric encryption would require a key exchange over an insecure channel, which kind of defeats the purpose.

I haven't tried it myself, but I found this library for doing RSA encryption in javascript.

axel_c