title: Secure login: public key encryption in PHP and Javascript
body: <p>I'm trying to make a "normal" username/password login form secure, without needing HTTPS. My idea is this:</p>
  
  <ul>
  <li>Server generates a keypair for some kind of assymetric encryption algorithm. It stores this keypair in a temporary table of sorts (or perhaps the local session data).</li>
  <li>Server sends the form to the client and includes the public key.</li>
  <li>User fills in the form.</li>
  <li>Before it's sent to the server, Javascript encrypts the password using the given public key.</li>
  <li>Form is sent.</li>
  <li>Server decrypts the password with it's private key (which it gets from the temporary table, using the public key to find it).</li>
  </ul>
  
  <p>What I need to know for this is:</p>
  
  <ul>
  <li>Which encryption method is the best to use? RSA?</li>
  <li>How can I decrypt the password in PHP?</li>
  <li>And probably the most difficult one, how can I make Javascript encrypt the password?</li>
  </ul>