uses ...ScBridge, ScUtils;
var
Source, Signed: TBytes;
aComment: string;
Key: TScKey;
begin
Key := TScKey.Create();
Key.ImportFrom('MyKeyFile.pem', Password, aComment);
Signed := Key.Sign(Source, haSHA2_256);
if Key.VerifySign(Source, Signed, haSHA2_256) = True then
// Sign is verified
Key.Free;
end;
Important Note: The TScKey object is designed to work with TBytes buffers and cannot directly sign files. Therefore, ensure that the Source TBytes buffer is populated with the data you intend to sign before calling the TScKey.Sign method.
See also: