Skip to content

Commit

Permalink
Handle invalid signature case properly
Browse files Browse the repository at this point in the history
  • Loading branch information
sink772 committed Sep 2, 2024
1 parent 5d494e3 commit 7bf8b27
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion javaee/rt/src/java/foundation/icon/ee/util/Crypto.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ public static byte[] aggregate(String type, byte[] prevAgg, byte[] values) {
public static byte[] recoverKey(byte[] msgHash, byte[] signature, boolean compressed) {
BigInteger r = BigIntegers.fromUnsignedByteArray(signature, 0, 32);
BigInteger s = BigIntegers.fromUnsignedByteArray(signature, 32, 32);
return recoverFromSignature(signature[64], r, s, msgHash, compressed);
var k = recoverFromSignature(signature[64], r, s, msgHash, compressed);
require(k != null, "invalid signature");
return k;
}

public static byte[] getAddressBytesFromKey(byte[] pubKey) {
Expand Down

0 comments on commit 7bf8b27

Please sign in to comment.