hi i use OverbyteIcsWSocket + DCPcrypt2
i have try to make
TCP server with md5 Authentication + 3des crypt
example:
user name = somtimg
pasword = pass
and
des key = 1020304050607080901011121314
i have got this mesage from client ( Server random key length is 19 and must be 14)
hire is (normal
tcp server)
var
MyHostName : AnsiString;
begin
WSocket_gethostname(MyHostName);
Display(' I am "' + String(MyHostName) + '"');
Display('
IP: ' + LocalIPList.Text);
WSocketServer1.SocksUsercode := 'user';
WSocketServer1.SocksPassword := 'pass';
WSocketServer1.Proto := '
tcp'; { Use
TCP protocol }
WSocketServer1.Port := '400'; { Use telnet port }
WSocketServer1.Addr := '0.0.0.0'; { Use any interface }
WSocketServer1.ClientClass := TTcpSrvClient; { Use our component }
WSocketServer1.Listen; { Start litening }
Display('Waiting for clients...');
hire is string 3des crypt
procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
Cipher: TDCP_3des;
KeyStr: string;
begin
KeyStr:= '';
if InputQuery('Passphrase','Enter passphrase',KeyStr) then // get the passphrase
begin
Cipher:= TDCP_3des.Create(Self);
Cipher.InitStr(KeyStr,TDCP_sha1); // initialize the cipher with a hash of the passphrase
for i:= 0 to Memo1.Lines.Count-1 do // encrypt the contents of the memo
Memo1.Lines[i]:= Cipher.EncryptString(Memo1.Lines[i]);
Cipher.Burn;
Cipher.Free;
end;
Decrypt
procedure TForm1.Button2Click(Sender: TObject);
var
i: integer;
Cipher: TDCP_3des;
KeyStr: string;
begin
KeyStr:= '';
if InputQuery('Passphrase','Enter passphrase',KeyStr) then // get the passphrase
begin
Cipher:= TDCP_3des.Create(Self);
Cipher.InitStr(KeyStr,TDCP_sha1); // initialize the cipher with a hash of the passphrase
for i:= 0 to Memo1.Lines.Count-1 do // decrypt the contents of the memo
Memo1.Lines[i]:= Cipher.DecryptString(Memo1.Lines[i]);
Cipher.Burn;
Cipher.Free;
end;
this work on (3des string crypt )
but i need
tcp server crypt/decrypt Big plise small example.