As I am looking for AES-128 encryption, I'd like to get Lockbox3 running on Delphi2010.
The first problem here: What/where are the official sources?
The sources from https://sourceforge.net/projects/tplockbox/ don't hold packages for Delphi2010 and also simply don't compile (loads of errors).
https://code.google.com/archive/p/tplockbox/ is not maintained anymore and points to https://github.com/SeanBDurkin/tplockbox.
I downloaded the sources from github, I think in V3.6.3 (version is nowhere mentioned in the sources, right?). The packages can be installed, but e.g. the MakeSampleKey example doesn't compile, as EncryptString doesn't work with AnsiStrings (umfmMakeSampleKey.pas, line 216).
I have then created a project and used the source from the OP of How to AES-128 encrypt a string using a password in Delphi and decrypt in C#?
I changed CipherText from AnsiString to String. The code compiles, but when I run it, it crashes with "Integer overflow" in TPLB3.SHA1.pas, line 264.
Is LockBox3 still maintained and is it usable for Delphi2010? If yes, then how? What do I do wrong? Thx!
Edit: There's another GitHub project hosting LockBox3, namely https://github.com/TurboPack/LockBox3 The recent sources from there do NOT compile under Delphi2010. (see comments under OP for a short list of problems)
Edit: Here's some code I try to use (and fail) - i post it here as I don't manage to post it formatted into a comment:
function LockBox3_EncryptText_AES_128(input: string; password: string): string;
var
Codec: TCodec;
CipherText: String;
begin
Codec := TCodec.Create(nil);
try
Codec.CryptoLibrary := TCryptographicLibrary.Create(Codec);
Codec.StreamCipherId := BlockCipher_ProgID;
Codec.BlockCipherId := Format(AES_ProgId, [128]);
Codec.ChainModeId := CBC_ProgId;
Codec.Password := Password;
Codec.EncryptString(input, CipherText);
Result := string(CipherText);
finally
Codec.Free;
end;
end;
I maintain LockBox 3 at http://lockbox.seanbdurkin.id.au/HomePage .
The repo is at https://github.com/SeanBDurkin/tplockbox .
Yes, it works for D2010.
Update
This works for me, with Delphi 2010 and TPLB3 version 3.6.3
Output
When run, the output yields ...