qiu_networksecurity_project1

所属分类:加密解密
开发工具:Java
文件大小:14KB
下载次数:21
上传日期:2009-03-12 19:01:42
上 传 者javaissogood
说明:  这是我写的一个关于JAVA SOCKET的程序,一个Server可以同时接受多个clients的requests,每次server和client之间的交流的信息都会被DES算法加密和解密
(-------------------------------------------------------------------------------- First version by Qiu Shi, March 11, 2009 Email: qs84727@gmail.com Reference: J2SE 6.0 API, SUN special security API -------------------------------------------------------------------------------- Program big picture: This program is designed for server and client communication as required by homework descriptions. Plus, I use some java multi-thread technique to make it as a one server communicating with multi-clients at the same time and the server will be always on, just like in the real world. There are total 2 directories, one named server which has all the java classes for server to run properly and some other files holding the users password hash values as well as shared secret keys the other one named client which has all the java classes for clients to run properly and also some other files holding the users shared keys. In client directory: Client.java--- This class is used to de)

文件列表:
qiu_networksecurity_project1 (0, 2009-03-11)
qiu_networksecurity_project1\client (0, 2009-03-11)
qiu_networksecurity_project1\client\Client.java (4790, 2009-03-11)
qiu_networksecurity_project1\client\DesApp.java (3132, 2009-03-11)
qiu_networksecurity_project1\client\InputMasking.java (896, 2009-03-08)
qiu_networksecurity_project1\client\MaskingThread.java (553, 2009-03-08)
qiu_networksecurity_project1\client\qiu.key (11, 2009-03-09)
qiu_networksecurity_project1\client\RunClient.java (198, 2009-03-11)
qiu_networksecurity_project1\client\shi.key (11, 2009-03-10)
qiu_networksecurity_project1\client\tianyuan.key (21, 2009-03-10)
qiu_networksecurity_project1\server (0, 2009-03-11)
qiu_networksecurity_project1\server\CommunicatePipe.java (3562, 2009-03-11)
qiu_networksecurity_project1\server\DesApp.java (3132, 2009-03-11)
qiu_networksecurity_project1\server\qiu.hash (11, 2009-03-09)
qiu_networksecurity_project1\server\qiu.key (11, 2009-03-09)
qiu_networksecurity_project1\server\RunServer.java (224, 2009-03-11)
qiu_networksecurity_project1\server\RunServer.java.bak (241, 2009-03-10)
qiu_networksecurity_project1\server\shi.hash (11, 2009-03-10)
qiu_networksecurity_project1\server\shi.key (11, 2009-03-10)
qiu_networksecurity_project1\server\TCPServerM.java (4610, 2009-03-11)
qiu_networksecurity_project1\server\TCPServerM.java.bak (4580, 2009-03-11)
qiu_networksecurity_project1\server\tianyuan.hash (16, 2009-03-10)
qiu_networksecurity_project1\server\tianyuan.key (21, 2009-03-10)

-------------------------------------------------------------------------------- First version by Qiu Shi, March 11, 2009 Email: qs84727@gmail.com Reference: J2SE 6.0 API, SUN special security API -------------------------------------------------------------------------------- Program big picture: This program is designed for server and client communication as required by homework descriptions. Plus, I use some java multi-thread technique to make it as a one server communicating with multi-clients at the same time and the server will be always on, just like in the real world. There are total 2 directories, one named server which has all the java classes for server to run properly and some other files holding the users' password hash values as well as shared secret keys; the other one named client which has all the java classes for clients to run properly and also some other files holding the users' shared keys. In client directory: Client.java --- This class is used to describe client's behaviors such as how to connect to server, how to write data to server via socket and io pipes and how to disconnect with server, etc. It also describes all the attributes a client must hold in order to perform its fucntions appropriately. DesApp.java --- Use this class to encrypt and decrypt data delivered between client and server. MaskingThread.java & InputMasking.java --- When we are trying to type the password in the termial, we definitely want to hide the actual password in some way, so we use these 2 class which is a special java thread to realize this effect. RunClient.java --- This is where the main fucntion is located. In server directory TCPServerM.java --- This class is used to describe server's typical behaviors such as authenticate a user's login, add a communication pipe to its container suff like that. This serve class is designed to be able to hold multi-clients at the same time. CommunicatePipe.java --- When multi-clients want to talk to server at the same time, we need multi commnication pipes for each of them, so basically every instance of this class is a thread which is resipondsible for communicating with one sepcific client. DesApp.java --- The same usage as the one in server directory RunServer.java --- This is where the main function is located. How to complie and run the program 1. Go into server directory, do the following commands Firstly: < javac RunServer.java < java RunServer 2. Go into client directory, do the following commands Firstly: < javac RunClient.java < java RunClient ip_address portnum 3. Follow the promotes provided by the program to do the input. I create 3 users for testing purposes, if you want to test more than 3 client at the same time, you can use one pair of username and password to login multi-times, like u can use username:qiu and pw:8888 to connect with server for many times with no problem. The 3 users are: username:password qiu:8888 shi:6666 tianyuan:0000 4. When a client input "bye", then it will be disconnected with the server, disconnecting connection by closing the terminal is not right, that will bring excpetions, so disconnecting the connection in the proper way is important too. The ip_address is the one where the server is runing on, the portnum is 8888, I don't take the filename as an argument, coz in my design, once the client get the username from user's input, it knows the filename automatically, the corresponding filename to a specific user is just "username.key". PS: When u firstly compile these two classes, u will get some warning, that is because I used some special SUN's security packages, which are not provided by the standard J2SE API, to assist the encryption and decryption process and I think the reason I want to use them is first of all they are pretty neat and second of all, they can make the encryption and decryption process faster and also make codes more clear. And when u try to compile them for the second time the warnings will be gone.

近期下载者

相关文件


收藏者