I am using Azure key vault for creating and storing my Secp256k1 keys. I am also using the sign API for getting my input string signed. I am working on a Secp256K1 blockchain network.These are steps I follow to get the signature in Golang.
- Converting my Hex string into Byte[]
- Sha256 of this Byte[]
- RawURL encoding of this Sha.
b64.RawURLEncoding.EncodeToString(sha)
- Sending this to Key vault for signature.
- Decoding the response using RawURLEncoding.
b64.RawURLEncoding.DecodeString(*keyOpsResp.Result)
- Doing Hex of the []Byte array returned from 5th Step.
- Sending the signature to the blockchain.
The problem I am facing is that signature is invalid sometimes. As in 2/5 times it works and other times signature verification fails. I am thinking there is some special chars or padding thing that I am missing. How can I resolve this?
PS: Azure uses non-deterministic signatures where as chains usually use deterministic signs. I did some reading and found out that for verification it does not matter both could be verified successfully. Let me know if I am wrong.