Check that the recovery id is valid

It must be 0,1,2 or 3, this is an explicit requirement of the secp256k1 library.
This commit is contained in:
sstone
2023-12-11 11:53:56 +01:00
parent 41eac9273f
commit 929e2cda40
3 changed files with 6 additions and 1 deletions

View File

@@ -275,6 +275,10 @@ class Secp256k1Test {
val pub0 = Secp256k1.ecdsaRecover(sig, message, 0)
val pub1 = Secp256k1.ecdsaRecover(sig, message, 1)
assertTrue(pub.contentEquals(pub0) || pub.contentEquals(pub1))
assertFails {
Secp256k1.ecdsaRecover(sig, message, 4)
}
}
@Test