|
@@ -229,7 +229,7 @@ var
|
|
|
kp: IAsymmetricCipherKeyPair;
|
|
kp: IAsymmetricCipherKeyPair;
|
|
|
privateKey: IEd25519PrivateKeyParameters;
|
|
privateKey: IEd25519PrivateKeyParameters;
|
|
|
publicKey: IEd25519PublicKeyParameters;
|
|
publicKey: IEd25519PublicKeyParameters;
|
|
|
- msg, signature: TCryptoLibByteArray;
|
|
|
|
|
|
|
+ msg, signature, wrongLengthSignature: TCryptoLibByteArray;
|
|
|
Signer, verifier: ISigner;
|
|
Signer, verifier: ISigner;
|
|
|
shouldVerify, shouldNotVerify: Boolean;
|
|
shouldVerify, shouldNotVerify: Boolean;
|
|
|
algorithmName: String;
|
|
algorithmName: String;
|
|
@@ -264,6 +264,18 @@ begin
|
|
|
Fail(Format('Ed25519 (%s) signature failed to verify', [algorithmName]));
|
|
Fail(Format('Ed25519 (%s) signature failed to verify', [algorithmName]));
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
+ wrongLengthSignature := TArrayUtils.Prepend(signature, Byte($00));
|
|
|
|
|
+
|
|
|
|
|
+ verifier.Init(False, publicKey);
|
|
|
|
|
+ verifier.BlockUpdate(msg, 0, System.length(msg));
|
|
|
|
|
+ shouldNotVerify := verifier.VerifySignature(wrongLengthSignature);
|
|
|
|
|
+
|
|
|
|
|
+ if (shouldNotVerify) then
|
|
|
|
|
+ begin
|
|
|
|
|
+ Fail(Format('Ed25519 (%s) wrong length signature incorrectly verified',
|
|
|
|
|
+ [algorithmName]));
|
|
|
|
|
+ end;
|
|
|
|
|
+
|
|
|
tempRand := FRandom.Next();
|
|
tempRand := FRandom.Next();
|
|
|
signature[tempRand mod System.length(signature)] :=
|
|
signature[tempRand mod System.length(signature)] :=
|
|
|
signature[tempRand mod System.length(signature)
|
|
signature[tempRand mod System.length(signature)
|