|
@@ -181,9 +181,12 @@ begin
|
|
properly checking the function result }
|
|
properly checking the function result }
|
|
AFileSize := -1;
|
|
AFileSize := -1;
|
|
FillChar(AFileHash, SizeOf(AFileHash), 0);
|
|
FillChar(AFileHash, SizeOf(AFileHash), 0);
|
|
|
|
+ AKeyUsedID := '';
|
|
|
|
|
|
if Length(AText) > ISSigTextFileLengthLimit then
|
|
if Length(AText) > ISSigTextFileLengthLimit then
|
|
- Exit(vsrMalformed);
|
|
|
|
|
|
+ Exit(vsrMalformed)
|
|
|
|
+ else if Length(AAllowedKeys) = 0 then
|
|
|
|
+ Exit(vsrKeyNotFound);
|
|
|
|
|
|
var SS := TStringScanner.Create(AText);
|
|
var SS := TStringScanner.Create(AText);
|
|
if not ConsumeLineValue(SS, 'format', TextValues.Format, 8, 8, NonControlASCIICharsSet) or
|
|
if not ConsumeLineValue(SS, 'format', TextValues.Format, 8, 8, NonControlASCIICharsSet) or
|
|
@@ -214,6 +217,7 @@ begin
|
|
end;
|
|
end;
|
|
if KeyUsed = nil then
|
|
if KeyUsed = nil then
|
|
Exit(vsrKeyNotFound);
|
|
Exit(vsrKeyNotFound);
|
|
|
|
+ AKeyUsedID := TextValues.KeyID;
|
|
|
|
|
|
const UnverifiedFileSize = StrToInt64(TextValues.FileSize);
|
|
const UnverifiedFileSize = StrToInt64(TextValues.FileSize);
|
|
const UnverifiedFileHash = SHA256DigestFromString(TextValues.FileHash);
|
|
const UnverifiedFileHash = SHA256DigestFromString(TextValues.FileHash);
|
|
@@ -224,7 +228,6 @@ begin
|
|
if KeyUsed.VerifySignature(HashToSign, Sig) then begin
|
|
if KeyUsed.VerifySignature(HashToSign, Sig) then begin
|
|
AFileSize := UnverifiedFileSize;
|
|
AFileSize := UnverifiedFileSize;
|
|
AFileHash := UnverifiedFileHash;
|
|
AFileHash := UnverifiedFileHash;
|
|
- AKeyUsedID := TextValues.KeyID;
|
|
|
|
Result := vsrSuccess;
|
|
Result := vsrSuccess;
|
|
end else
|
|
end else
|
|
Result := vsrBadSignature;
|
|
Result := vsrBadSignature;
|