You are not logged in.
Pages: 1
Using Delphi 10.1 Berlin and
mORMot-master (version 1.18, July 2018):
SynCommons.pas
SynCrypto.pas
SynLZ.pas.
-----------------
procedure TForm1.bnEncrypt1Click(Sender: TObject);
var Key:RawUTF8;
begin
Key:=StringToUTF8('ThisIsAsimplePassword');
try
if AESAbstract.SimpleEncryptFile(ed1.Text,ed2.Text,Key,true) then showmessage('1 OK') else showmessage('1 Error');
// Using win32 platform this results in 'Debugger Exception notification':
// 'Project Project1.exe raised exception class $C0000005 with message 'access violation at 0x006288ff: read of address 0x00000000'
// Using 'Continue' results in a Project1 message:
// 'Access violation at address 006288ff in module 'Project.exe'. Read of address 00000000'
// Using win64 platform similar messages.
except
on E:Exception do showmessage(E.message);
// However: no such exception is raised...
end;
end;
------------------------------------------------------------------------
The problems encountered are described in the lines with double shashes.
Please help: what did i do wrong?
Thanks!
Offline
What is AESAbstract????
You need to use a proper class corresponding to a given block chaining mode.
For instance, TAESOFB.SimpleEncryptFile().
Please read the documentation and study the code.
Offline
-1-
Of course it must be TAESAbstract.
In a previous try-out version I used TAESAbstract and forgot the T here, sorry.
Now the exception is correctly raised.
However: i still receive the exception 'Abstract Error'.
-2-
(below all line numbers are in SynCrypto.pas, version 1.18, July 2018)
TAESAbstract is defined on line 533 of SynScrypto.pas:
TAESAbstract = class(TSynPersistent)
line 739 defines it's class function SimpleEncryptFile()
lines 12110-12523 gives the details of { TAESAbstract }
line 12487 gives the function i use: class function TAESAbstract.SimpleEncryptFile()
I understand I do not have to initialize AESAbstract as
the function which is encapsulated, class function TAESAbstract.SimpleEncrypt(),
initiates the instance itself.
When I go step by step into TAESbstract.SimpleEncryptFile()
all goes well until, inside TAESAbstract.EncryptPKCS7Buffer()
line 12264 is reached: Encrypt(Output,Output,InputLen+padding);
Stepping inside Encrypt results in procedure _AbstractError
Maybe this is caused by the fact that
line 591 defines: procedure Encrypt(BufIn, BufOut: pointer; Count: cardinal); virtual; abstract;
but the details of TAESAbstract.Encrypt() itself are not given.
I could not find this procedure/method in Delphi itself either.
Please help me a step further.
Thank you in advance.
Offline
Did you read my previous answer?
You need to use a proper class corresponding to a given block chaining mode.
For instance, TAESOFB.SimpleEncryptFile().
A TAESAbract is an abstract class, and should not be used directly - it is clearly documented as such!
use any of the inherited implementation, corresponding to the chaining mode required - TAESECB, TAESCBC, TAESCFB, TAESOFB and TAESCTR classes to handle in ECB, CBC, CFB, OFB and CTR mode (including PKCS7-like padding)
https://synopse.info/files/html/api-1.1 … ESABSTRACT
Offline
Thanks.
I did read your previous answer, but not interprete it correctly.
Now I understand what you meant. Sorry to have disturbed you.
All works fine now.
Merci beaucoup
Offline
Pages: 1