Happy holidays to you too and too everyone !
Nice and thank you for work and contribution!
One very small thing i saw here
https://github.com/MHumm/DelphiEncry...as#L1451-L1453
This should be
exception raised in consistent with the used style and coding, if the length is 0 this PKCS7 padding is absent and broken.
on side note: these
exception in general, not only in PKCS7 or any specific
unit
raise EDECCipherException.Create('xxxxxxxxxx');
Can affect performance due to code for string handling inserted by the compiler, although using TBytes itself does that too, so the following is not so important performance wise in this case per se, but..
replacing these calls with something centralized would be contain the usage of the strings and open the door for localization or at least just translating, it is cosmetic suggestion mostly.
example
as procedure DECExceptionRaise(DECEXCEPT_CIPHER_PADDING_PKCS7_INVALID;...);
And this could be applied to other
exception across the library to make it useful, see these
https://github.com/MHumm/DelphiEncry...Modes.pas#L483
Delphi-Quellcode:
resourcestring
sInvalidMessageLength = 'Message length for mode %0:s must be a multiple of %1:d bytes';
sInvalidBlockSize = 'Block size must be %0:d bit for selected mode %1:s';
sInvalidModeForMethod = 'Invalid mode for this method. Mode must be %0:s';
.....
procedure TDECCipherModes.SetDataToAuthenticate(const Value: TBytes);
begin
if (FMode = cmGCM) then
FGCM.DataToAuthenticate := Value
else
raise EDECCipherException.CreateResFmt(@sInvalidModeForMethod, ['cmGCM']);
end;