Exetools  

Go Back   Exetools > General > General Discussion

Notices

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 10-22-2011, 03:49
TmC TmC is offline
VIP
 
Join Date: Aug 2004
Posts: 330
Rept. Given: 1
Rept. Rcvd 15 Times in 9 Posts
Thanks Given: 2
Thanks Rcvd at 23 Times in 17 Posts
TmC Reputation: 15
OK...the problem is partly solved. Partly because one application begun to work perfeclty even under rad studio XE, while the other fails exactly as beginning. here i paste code from the first and the second:

WORKING APP (previously not working)

Code:
procedure TMainForm.BitBtn4Click(Sender: TObject);
var
  content, instr, opt: AnsiString;
  open: File;
begin
slist.Clear;
OD.DefaultExt := '.sif';
OD.Filter := 'Signatrol Instruction File|*.sif';
OD.Title := 'Please specify a valid Instruction File to load';
while OD.FileName = '' do
begin
OD.Execute;
try
begin
AssignFile(open,OD.FileName);
FileMode := fmOpenRead;
Reset(open,1);
SetLength(content,FileSize(open));
BlockRead(open,content[1],Length(content));
CloseFile(open);
end
except
Messagebox(Application.Handle,'Error while opening the file. Please check that the file exists and it is a valid Signatrol Instruction File and try again!','Severe',MB_ICONERROR);
Exit;
end;
end;
if Copy(content,1,10) <> 'SIGNATROLV' then
begin
Messagebox(Application.Handle,'This is not a valid Signatrol Instruction File. Please specify a valid Signatrol Instruction File and try again!','Severe',MB_ICONERROR);
Exit;
end;
OD.FileName := '';
content := Copy(content,Pos('$',content)+1,Length(content));
content := RC6Decrypt(content,'SIGNATROLV1183919102011');
if Copy(SHA1(Copy(content,1,Pos('###BSB###',content)-1)),1,40) <> Copy(content,Pos('###BSB###',content)+9,40) then
begin
Messagebox(Application.Handle,'File Corrupted! This file was damaged by a Virus or a Bad Sector and can''t be used anymore. Please specify another file try again!','Severe',MB_ICONERROR);
Exit;
end;
content := Copy(content,1,Pos('###BSB###', content) -1);
instr := Copy(content,1,Pos('###EDB###',content)+8);
opt := Copy(content,Pos('###BOB###',content),Length(content));
instr := StringReplace(instr,'###BDB###','',[rfReplaceAll]);
instr := StringReplace(instr,'###EDB###','',[rfReplaceAll]);
while Pos('#',instr) <> 0 do
begin
slist.AddItem(Copy(instr,1,Pos('#',instr)-1),nil);
instr := Copy(instr,Pos('#',instr)+1,Length(instr));
end;
slist.AddItem(instr,nil);
opt := StringReplace(opt,'###BOB###','',[rfReplaceAll]);
opt := StringReplace(opt,'###EOB###','',[rfReplaceAll]);
txtSpanS.Text := opt;
end;
NOT WORKING APP

Code:
function TLIC.intCheckLicKey(actcode: AnsiString): boolean;
var
  licdata: array of AnsiString;
  tmp, xx: String;
  ok: boolean;
  r, s, generator : AnsiString;
  p, q, g, y: TBIGInt;
  z,i: integer;
begin
actcode := licdata[0] + #13#10 + licdata[1] + #13#10 + licdata[2] + #13#10 + licdata[3] + #13#10 + licdata[4] + #13#10 + licdata[5] + #13#10 + licdata[6] + #13#10 + licdata[7] + #13#10 + licdata[8] + #13#10 + licdata[9] + #13#10 + licdata[10] + #13#10 + licdata[14];
s := licdata[11] + licData[12];
s := StringReplace(s,'-','',[rfReplaceAll]);
ConvertHexStringToBase256String(s,s);
r := intRC6Decrypt(Base64DecodeStr(licdata[13]),intCertificate.LSSigKeySeed); <--- I BELIEVE THIS IS THE CAUSE OF THE FAILURE
Base10StringToBIGInt(intCertificate.LSSigKeyQ,q);
Base10StringToBIGInt(intCertificate.LSSigKeyP,p);
Base10StringToBIGInt(intCertificate.LSSigKeyG,g);
Base10StringToBIGInt(intCertificate.LSSigKeyY,y);
DSAVerify(p, q, g, y, actcode, r, s, ok);
if ok then
begin
//GOOD BOY
end
else
begin
//BAD BOY
end;
The actual DSAVerify works very good, because if I replace the decrypted (partially incorrectly) from the memory loading from an external textbox (like told upper in this thread) it returns true. The same exact code in Delphi 7 works, while in Rad Studio XE does not.
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT +8. The time now is 16:45.


Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX, chessgod101
( Since 1998 )