After a lot of digging and testing. I believe this is the appropriate way to deserialize the signature.
final Sign.SignatureData signatureData = new Sign.SignatureData(
Arrays.copyOfRange(signatureBytes, 64, 65),
Arrays.copyOfRange(signatureBytes, 0, 32),
Arrays.copyOfRange(signatureBytes, 32, 64)
Similar implementation here:
. eth-lib/account.js at master · MaiaVictor/eth-lib · GitHub
Which I believe is used here
. caver-js/utils.js at dev · klaytn/caver-js · GitHub
However, using this approach, along with carver-java’s “Utils.recover()” method, I’m unable to correctly extract the address used to sign an arbitrary string with the Kaikas wallet on the kaikas tutorials site.
When I run a
Utils.recover("test", signatureData /* as deserialized above*/)
I get the following address:
Which naturally is not a match and does not validate.
However, if I use the private key for this address
To sign a message using
And then run a
Utils.recover on that, I get the correct address as a result.
What do I need to do differently to verify Kaikas signatures? It would seem that they are using a different algorithm.