473,394 Members | 1,481 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Authentication for socket communication ...

Hey!

Im using a derived HTTP socket server, the base class in python.
I've got a modified version of the implementation, right now I
want to introduce authentication of users in my server. What is
the best way to implement this? The server is on the machine running
the user database.

So how do I validate a user and a password with the system?
Are there any modules for this? How should passwords be sent?
Using clear-text isnt good enough!

Thanks!

// Mike
Jul 18 '05 #1
1 4739
Im using a derived HTTP socket server, the base class in python.
I've got a modified version of the implementation, right now I
want to introduce authentication of users in my server. What is
the best way to implement this? The server is on the machine running
the user database.

So how do I validate a user and a password with the system?
Are there any modules for this? How should passwords be sent?
Using clear-text isnt good enough!

Well, I would suggest HTTPS because it is transparent so you can send
the password safely.
However, you said you are using a derived version of the HTTP socket
server. Probably
it cannot handle HTTPS. In that case, it is a very good idea to use OTP
(One Time Password)
authentication. The basic idea is that you do not send the passwords in
clear text. Instead of
that, you send a hash of the password. The hash function must be
different for each connection.
There are standards (RFCs) for OTP authentication. But of course you can
implement yours.

For standard OTP, please read the RFCs. You will need OpenSSL to follow
the standards.

To create your own OTP algorithm, please follow this scheme:

1. Client connects to the server
2. Client sends the user name to the server
3. The server generates a random string and sends it to the client
4. The client generates a random string and sends it to the client
5. At this point, both the server and the client know both random
strings and the password.
Both the server and the client should setup a session key using
these values.
A listener person or in-the-middle attacker cannot calculate the
same session key because it does not know
anything about the password. Important: the generation of the
session key should be FULLY dependent
on both of the random strings and the password and should be
non-invertable (e.g. use cryptographically
secure hash functions).
6. Optional: After this point you have a session key on both sides, you
can setup a cipher on both sides to have an encrypted connection
7. Both the server and the client shoud setup a new hash function H()
that is dependent on the session key
8. The server sends another random string
9. The client calculates its hash value using H()
10. The client sends back the calculated hash value
11. The server checks if the hash value maches the one calculated
locally. If not, terminate the connection. If there is a match then the
authentication was successful.

The advantage of your own protocol is...

a.) You only need a hash function. No encryption, no openssl etc. The
built-in sha module is more than enough. As a result, your software will
be more portable.
b.) In theory, in specific scenarios, this system can be more secure
than a standard authentication algorithm. E.g. if your clients and your
servers are totally trustful then using a private protocol can be very
hard to crack. (Of course this is not the case when you want to create a
widely used, popular program.)

Hope this helps.

Best,

Laci 2.0


Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Lindstrom Greg - glinds | last post by:
Hello- I have a python routine (Python 2.2.3 on Windows 2000 "Professional") using a socket connection. Problem is, the backend service I'm connecting to will hang every so often and the socket...
4
by: faktujaa | last post by:
Hi, I am having some problem with callback used in socket implementation. private static void Connect(string strPrtrIPAddr, int intPrtrPort, ref Socket rsocClient) { try { // Create remote end...
2
by: tantiboh | last post by:
I'm not a new programmer, but this one's got me stymied; hopefully it's a fairly trivial problem. I'm using a socket connection to receive communication from a server. Normally, the entire message...
3
by: Ricardo Quintanilla | last post by:
i had a problem whom i do not know how to explain. i was using a TcpClient (System.Net.Sockets.TcpClient) object to send and receive data to an AS400 socket. Two months ago it started to work...
4
by: Sačo Zagoranski | last post by:
Hi! I'm writing a simple 3D First person shooter game. It is a multiplayer game, where all the players connect to one server.
7
by: Ole | last post by:
Hi, I'm going to develop a socket communication between an instrument (running CE 5.0 with Compact Fraework V2) and a PC. As the instrument should only connect to one PC at a time I believe that...
8
by: panko | last post by:
Hello, I can't manage with asynchronous socket communication. :( I wrote a class CSocket.cs. This class is taking care of sending strings to LED display. This display is actually communicating...
0
by: =?Utf-8?B?QWxwZXIgQUtDQVlPWg==?= | last post by:
Hello, First of all I wish you a good day. My help request is about .NET asynchrounus socket communication. I have developed Server-Client Windows Forms .NET applications in VC++ .NET v2003. I...
0
by: Mangabasi | last post by:
Howdy, I would like to use the Synthesis Toolkit for a demo. I downloaded the STK from http://ccrma.stanford.edu/software/stk/index.html. It seems very powerful and user friendly. There are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.