资源描述:
《网络编程大作业4new》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、1NetworkSecurity–SecureMulti-userChatProgrammingAssignment4(40points)Objective:TouseJavaCryptographyExtension(JCE)todevelopafully-securedmulti-userchatprogram.Background:Inyourpreviouscourse,NetworkProgramming,youdevelopedamulti-userchatprogram,whichyouroldersisterfrequentlyusestocommunicatewith
2、herboyfriendovertheInternet.However,byhiringtheCNSA(theChineseequivalentoftheUSA'sNationalSecurityAgency)toeavesdroponhercommunication,yourbigmotherdiscoveredthatsheandherboyfriendplantodropoutof大连理工大学andrunawaytogetmarried.Yoursister,althoughmuchsmarterthanyou,knowslittleaboutcomputersandspecif
3、ically,computerandnetworksecurityandhasagreedtopayyou1,000,000Ұtodevelopafully-securedmulti-userchatprogramsothatsheandherboyfriendcancontinuetocommunicatebutthistime,secretly.Mostimportantly,yoursisterdemandsthatallcommunicationsshouldbefullysecurednotjustfromyournosyandintrusivemother,butalsof
4、romanybody,includingtheCNSAandtheNSA.Requirements:UsingyourlastprogramfromNetworkProgrammingasthebuildingblock,wenowneedtoaddseverallayersofsecurity.First,thecommunicationbetweentheserverandusershouldbeencryptedusingRC4andasessionkey,whichisatemporarykeyusedonlyforsecuringthecommunicationbetween
5、theserveranduser.Asyouknow,RC4isastreamcipher,butisassecureasblockcipherssuchas3DESandAES.ThemainadvantageofusingRC4hereisbecauseitisveryfastandisidealforencryptingstreamsofdata(arbitrarylengthsofdata),suchasusers'messages.Theservernotonlyactsasthechatserver,butalsoastheauthenticationcenter.Thec
6、hatserverkeepsalistofalltheusers'(userswhohavealreadysetupanaccountwiththeserver)namesandpasswordsinafileontheharddrive.ThefileshouldatalltimesbeencryptedwithAESusinga128-bitkey(Seebelowforthekey)thatonlytheserverknows.LoginProcedureforanexistinguser1.Itcontactstheserverandrequestsitspublickey.T
7、hepublickeyissenttotheuser.2.Theusergeneratesasessionkey(RC4)andsendsitsusername,password,andthesessionkeytotheserver.3.Theserverdecryptsthemessagewithitsprivatekeyandrecoverstheusername,password,andsessionkey.4.Theserverche