I need to implement a free of charge scheme (no SSL certificate) which can meet the requirements on the sensitive data transmission, protection and storage, assuming mutually trusted third party is not available, that is, we cannot use SSL, TLS etc. But this doesn't means I will implement SSL by myself, I still would like to outsourcing encryption and decryption parts to existing codes.
I have drafted below scheme as my account and password protection solution:
Assumptions on our attackers:
have complete knowledge of the protocol.
have access to a large dictionary of commonly used passwords.
can eavesdrop on all communications between client and server.
can intercept, modify, and forge arbitrary messages between client and server.
can access the source codes (including encryption code) on the client-side.
Solutions:
RSA (encryption & decryption on client and server sites respectively, public key is safe for transmission, there are not risk if the key is obtained by a hacker.)
SHA256/SHA512/Twice MD5 (Encryption with User ID binding Salt, both stored in database on the server site. I use binding salt here to avoid common password and prevent rainbow table.)
Registering a New User:
First Generate RSA keys on server end ( Stored in session);
Send public key to client;
Store public keys in javascript variable;
In All subsequent requests use this key to encrypt data and send to server;
Use private keys stored in session to decrypt user account and password on server side;
Encrypt the passwords with one-way encryption algorithm with a random salt (like the common opinion: SHA-256 is stronger than MD5);
Store the user id , the hash password and the random salt (user id binding) into database ( avoid common password and building specific rainbow table).
Existing User Login:
First Generate RSA keys on server end (stored in session);
Send public key to client;
Store public keys in javascript variable;
In All subsequent requests use this key to encrypt data and send to server;
Use private keys stored in session to decrypt user account and password on server side;
Fetch the hash password and the salt from database by using the user account;
Encrypt the passwords with one-way encryption algorithm with the obtained random salt;
Compare the encrypted password with the hash password obtained from the database;
Determine login success or failure.
I am new in this parts and I do need some professional suggestions from you? Is the scheme secure enough? Many thanks.