首页  编辑  

Delphi编写网络程序的安全措施

Tags: /超级猛料/Network.网络通讯/其它/   Date Created:

---- DelphiMIDASؼΪдṩʮֶַΡЩؼԱдϵĿͻϵҲܷInternetϴɢӦá

---- һҪǰȫԿǡһЩϴͣпܱ˷ǷɲҪʧʵʵı̹УҲȡһЩЧķʩڴЩ򵥵Ľܡ

---- һ ԭ

---- Ŀǰݼܵķܶ࣬ݵıһáù̶ԿԿһܴͣﵽıЧʵУһסӦģʽԿݵıЧʮ⡣

---- ͻ˳ͼʱͻӷȡһɷִϵͳԴִΪԿû¼ݡԿɷͻÿε¼ʱԿͬ˴뱻صݱԵĿԡ

---- ˿ԶģһԶӿڣýӿڷһִԶģҪ¼ִΪԿִIJԶֶ򵥵ķRandom()һɴFormat()IntToStr()һַ

---- û¼ʩ

---- Ϊ˷ֹ򱻷ǷԴӶй¶룬뽫ͻĵ¼Ϣڷ˴Ҳרһȫ㸺ͻĵ¼ͻĵ¼ϢڿͻϱУû롢Ȩ޵Ϣ

---- ͻ¼ʱȵ÷ĽӿڻԿִôԿûûмܲ͵¼Ϣ㷨DES㷨Ч㷨ӵ¼Ϣǰ¼ԿԵ¼ϢнܣٽܺϢ洢ĿͻϱеϢжգӶжϿͻϢǷϷԼÿͻеȨ޵ȡ

---- ù̵Ŀͻ˳£

strKey:=myRemoteSever.GetKey();    

   {÷ĽӿڻԿ}

UserName:=Ency(strUserName,strKey);  

 {ûܣEncy()Ϊ㷨}

Password:=Ency(strPassword,strKey);  

 {Ե¼м}

If myRemoteServer.LogIn(UserName,Password) then  {¼}

 Begin

{д}

 End;

˵ĵ¼LogIn()£

strUserName:=DeEncy(UserName,strKey);

{ûܣDeEncy()Ϊ㷨}

strPassword:=DeEncy(Password,strKey);  

 {Ե¼}

{ѯݿ}

if (Pass) then

 Result:=true

Else

 Result:=false;

---- ҪעǣڷͿͻУStrKeyӦΪȫ̱

---- Ϊ˷ֹͻϱ򿪴Ӷй¶룬ԶԿͻϽһļܴʩPARADOXPasswordڷʿͻϱʱṩPassword

---- ݴ

---- УһЩϴʱܡDelphiMIDASṩݼܵ;ݴͻ֮ǰһЩֶνмܣҲڽյͻ˵ĸԿͻ˵ݵӦֶνнܺݿи¡Ϊ˴ﵽЩĿģڷԶģмһTproviderTdataSetProvider󣬲˶DataSetΪҪݼTproviderOnGetData¼м´룺

 with DataSet do

 begin

   while not EOF do

   begin

     Edit;

     SensitiveData.AsString :=

     Ency(SensitiveData.AsString,strKey);

   {ݼ}

     Post;

     Next;

   end;

 end;

---- ϴԽݼܺͻ

---- ͬTproviderOnUpdateData¼мһЩɶԿͻݽнܡ

---- ֻǽȫʩʵֵһԭڴ˻ϣܴʩԴﵽõıЧ磬ͻضĸӲ豸ӰȫԡܿӦóУͻڵ¼ʱҪûû룬ͬʱICдICͼضݣʹй¶˲ᱻð¼ȻκΰȫʩǾ԰ȫģȫʩҪϸıƶȼʹԱĸ߶ȵıʶ𵽱á