Cant encrypt key

I get it. SHA1 is deprecated and should no longer be used in general. However in the MGF, that's not that a big issue.
The current MGF uses the same hash function for the message digest and padding and SHA1 should work. Now, if you want SHA2 for the message and SHA1 for the MGF, I need to add a new parameter to the RSA class for the MGF.
Is that what you want?

i resolved it i think,
there is a bug in
Sha1core.pas
procedure TSHA1.BufferHash(inputBuffer: TBytes; var bHash: TBytes);
..
for I := 0 to Length(inputBuffer) do
aMessage[I] := inputBuffer[I];

this fails first round as inputbuffer is 0 length

i've changed it to
if Length(inputBuffer) > 0 then
for I := 0 to Length(inputBuffer) do
aMessage[I] := inputBuffer[I];

Ok, thanks. It should even be Length(inputBuffer) - 1
I'll fix it

Thank you for the help, now I've removed my old openssl command line calls from project and use rsa component instead :)

1 Like