Hello everyone,
I was brainstorming about this and I was hoping someone could check
my logic. I want to be able to secure the connection between a
client and server using encryption. Now from a technical perspective
I know that an Asymetric system is best because you don't have to
worry about sending keys over the network in plain text, but lets
assume for the discussion that Asymetric encryption is not an option
(mainly because I don't want the hassle of managing key pairs).
Lets assume that both the client and the server know a password. My
first thought was lets only encrypt messages that have sensitive
data like login messages that contain the password. So the idea was
that we would take a login message, which can contain the password,
but doesn't need to, and encrypt it using the password. The client
would then send this message to the server, which would upon
successful decryption would recognize the client. The immediate
problem with this is that the encrypted message is the same every
time, and a would be attacker only needs to capture the encrypted
message, and then later send the message as is to the server to
authenticate as the victim.
What I needed was a way to make the login message different every
time. The following is what I came up with and I hope to get help
on. When a user first connects they send a message to the server
contianing thier username in plain text. The server then looks up
the user in a database and loads that users password. The server
also generates a random key. The server then encrypts the random key
with the users password. The encrypted random key is sent to the
client. The client who should already know their password decrypts
the random key. The client then uses this random key to encrypt a
login message that does not contain their password. The random key
encrypted login message is sent to the server. The server then uses
the random key it generated earlier to decrypt the login
message. Finally if login message is sucessfully decrypted, then the
server knows that client was able to decrypt the random key and
therefore knows the password.
The advantages of this processes from my perspective are:
1) common packets are different with each session because they are
influenced by random input.
2) the user password is never sent in any form.
3) high power asymetrical algorithms like AES (Rijndael) are
suitable.
4) No management or generation of key pairs.
The weaknesses that I am aware of are
1) Both parties must know a password ahead of time
2) The password is vulnerable when sent by mediums such as email
3) I don't know enough about encryption to know what other flaws
may be.
4) In my implementation the Initialization Vector is easily found
in the open source code. (Is this a problem?)
Any encryption experts out there willing to point out a weakness
that I don't already know about or comment on the severity of the
weaknesses I do know about?
Thanks,
-William Leader
www.k2wrpg.org