-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC6979 Usage for ECDSA Signing with secp256k1 #4
Comments
Hi, which method are you using to sign in Dart? If you're aiming to get the same result as in signature.go, I noticed that the code there doesn’t seem to check whether the s value is in the lower half of the curve order. I'm not sure, but I think this might lead to inconsistencies. To ensure consistent results and handle this properly, I recommend using:
|
Hey @mrtnetwork thank you for your prompt response! I am using sign from private key:
The method you provided produces almost same bytes sequence at the beginning, but afterwards it is really diverse. EDIT:
|
Which private key are you using? The
Each key uses a different elliptic curve. For your case, use |
Or you say that I can combine signing through |
I'm a bit confused :) Could you provide the complete working code? I’m trying to implement this in the Cosmos SDK. EDIT: I got it to work by normalizing s:
If this works for you, it should also work with In ECDSA, there are two approaches. One doesn't check the |
Sorry for confusing you :)
So what I wanted to say is that I needed to apply normalize logic from CosmosSigner to this code so I normalize s parameter to give me the correct output. |
ok this the code of
|
Just did a test again, EDIT: I thought that I need to forward sha256 digest but it seems it is done under the hood! All good. Thanks! |
Context:
I’m working on a Cosmos SDK project in Flutter/Dart, and I’m implementing RFC6979 deterministic ECDSA signing with the secp256k1 curve. While researching, I came across Decred’s implementation in signature.go, specifically the signRFC6979 method.
func signRFC6979(privKey *secp256k1.PrivateKey, hash []byte)
Is used to sign an iddoc 256 hash with private key. I am using your sign method from secp256k1 private key but it produces totally different output. What I can confirm is that private key and hash do match 100% before signing.
Goal:
I want to replicate the functionality of RFC6979 deterministic nonce generation and ECDSA signing in Dart, and I have a few specific questions around how Decred’s implementation works.
Questions:
The text was updated successfully, but these errors were encountered: