How to secure the sign up process if there is no ssl

I am building a sign up page for user to sign up as a member, and am wondering how to keep the user's password secure if I have no ssl-server.

The only way I can imagine is to md5 encrypt the user's password before sending back to server for storing, and next time while in login page, the password input will be md5 with a dynamic secret seed before sending back to the server to autheticate if the user is a member.

Is it a good idea? Any good suggestion? Do I have other option?

Thanks a lot for any good idea.



The problem is that you need some kind of shared secret between client and server that a possible eavesdropper does not know to be able to encrypt it. As the eavesdropper can also listen to all traffic between client and server beforehand, you have some kind of a chicken and egg situation.

Only way out: use public/private key encryption. The client encrypts the password with the public key of the server and then sends it. The only one who might open it is the owner of the private key, presumably your server.

Have a look at, it might do what you want.


First, it's worth trying to protect passwords even if the assets you're protecting do not require a high security approach - since too many people use the same password for different sites - however for a secure, public facing system there is no substitute for SSL.

It is possible to do this - if you hash the submitted password with a challenge from the server. And you've already got a suitable challenge available in the form of the PHP session id (although you need to ensure that you're not susceptible to session fixation, and there are also some security constraints around allowing the session cookie to be read from Javascript).

This of course depends on having an un-hashed password on the server to create a comparison value from. And this is a definite no-no. store the password hashed with a known salt (S1) on the server. When someone wants to login you send them a session id (S2) and S1 and they send back:

md5(S2 . md5(S1 .password));

There are javascript implementations of md5.

Md5 is approaching the end of usefulness as a secure cipher - however for the puproses stated here it should be adequate.


I guess you don't really need to decrypt it, as people normally only store the password hash in the database. (unless you want to know/harvest their password).

A common way is to has the password and send only the hash.

I'll suggest you to pass "salt" from the server side to the form, and hash the password and the salt together to make it more random.

To be really secure, you'll have to implement/find a public key encryption algorithm implemented in javascript. Using any symmetric key encryption would still be vulnerable to man in the middle attack as your key has to be transferred to the client side.


The real fix for this problem is to use real SSL/HTTPS connection.


  • If the content that is available after logging in is worth protecting, the whole session must be protected, not just the user password.
  • If the content is not worth protecting why require logging in at all?

Note that you do not need to use paid SSL certificate to get the benefits of SSL. You may sign your own (see for an example). However, recent versions of Firefox have made use of self signed certificates a pain in the ass unless the user is ready to install you as CA. (By some weird logic Firefox displays much less alarming dialog for adding a new CA than adding an exception for a singler server that uses self signed certificate. This is really bad because accepting a new CA accepts all certificates that will be signed by that CA in the future!)

However, if you insist on not using real SSL, you may implement encryption with JavaScript: or - be warned though that this requires a lot of work and the end result may end up nearly as protected as SSL if implemented correctly in every little detail. The end result will never be as safe as SSL because you have to transfer the JS script to the visitor's user agent (browser) without encryption and as a result, the visitor may end up running JavaScript selected by the attacker (the attacker can execute Man-in-the-Middle attack because otherwise you don't need any protection to the user password, either).


Certificate Authorities(CAs)'s Public keys stored in web browser is the only thing that prevents SSL/TSL to be not vulnerable to man in the middle attack. So, there is no way to protection these solutions.
All of these solutions are vulnerable to man in the middle attack.

Note that Mallory (Malicious active attacker) can replace his public key in the page.


You should be using SSL(the rest is NOT that secure) to do authentication and luckily you can by using open-source OpenID just like does. You can for example read why has switched to OpenID by reading this article(good read).

There is a very user-friendly OpenID library available from LightOpenID. I have created a little library "Openid for PHP with an user-friendly way to select an OpenID thanks openid-selector and LightOpenID" available at github. I also have put a demo on my webhosting available at


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.