-
Notifications
You must be signed in to change notification settings - Fork 100
Add low R signing #1342
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
Add low R signing #1342
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be useful to make a ECDummyLowRSignature as well
core-test/src/test/scala/org/bitcoins/core/crypto/SignTest.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, however, to implement this into the wallet will be tricky with how it is. Currently when we get signers, they will use only use the signFunction and not the signLowR function.
Maybe it would be worth creating a LowRSign type that extends Sign and defaults to low r signing.
* Added signing with entropy to the JNI and implemented low R signing * Added check for determinism of low R signing * Cleaned up test * Implemented signing with entropy in Bouncy Castle * Added docs for signing with entropy * Fixed things after rebase * De-parallelized signLowR and added scaladoc warnings to signWithEntropy
The goal is to make transaction sizes more predictable, simplifying the fee calculation. This change will make sure signatures will always have DER encodings of 70 bytes or less, without counting the sighash flags byte. Note that one of our tests for a BIP143 native P2WPKH test vector had to be changed, because that vector had been produced pre-grinding and hasn't been updated since. However, the change only affects a P2PK input which isn't really the focus of the test vector. Also see similar changes in other projects: bitcoin/bitcoin#13666 rust-bitcoin/rust-secp256k1#259 bitcoin-s/bitcoin-s#1342 + bitcoin-s/bitcoin-s#2408 bisq-network/bisq#7238 TODO extract HMacDSAKCalculatorWithEntrophy to top level class? TODO make encodeToCompact() its own commit? TODO more test vectors from other projects TODO should sigs with DER encodings *less* than 70 bytes also be retried?
The goal is to make transaction sizes more predictable, simplifying the fee calculation. This change will make sure signatures will always have DER encodings of 70 bytes or less, without counting the sighash flags byte. Note that one of our tests for a BIP143 native P2WPKH test vector had to be changed, because that vector had been produced pre-grinding and hasn't been updated since. However, the change only affects a P2PK input which isn't really the focus of the test vector. Also see similar changes in other projects: bitcoin/bitcoin#13666 rust-bitcoin/rust-secp256k1#259 bitcoin-s/bitcoin-s#1342 + bitcoin-s/bitcoin-s#2408 bisq-network/bisq#7238 TODO extract HMacDSAKCalculatorWithEntrophy to top level class? TODO make encodeToCompact() its own commit? TODO more test vectors from other projects TODO should sigs with DER encodings *less* than 70 bytes also be retried?
The goal is to make transaction sizes more predictable, simplifying the fee calculation. This change will make sure signatures will always have DER encodings of 70 bytes or less, without counting the sighash flags byte. Note that one of our tests for a BIP143 native P2WPKH test vector had to be changed, because that vector had been produced pre-grinding and hasn't been updated since. However, the change only affects a P2PK input which isn't really the focus of the test vector. Also see similar changes in other projects: bitcoin/bitcoin#13666 rust-bitcoin/rust-secp256k1#259 bitcoin-s/bitcoin-s#1342 + bitcoin-s/bitcoin-s#2408 spesmilo/electrum#5820 bisq-network/bisq#7238 TODO extract HMacDSAKCalculatorWithEntrophy to top level class? TODO make encodeToCompact() its own commit? TODO more test vectors from other projects TODO should sigs with DER encodings *less* than 70 bytes also be retried?
Introduces signing with entropy to the JNI.
Also introduces and tests low R signing as was introduced to bitcoin-core here.
Closes #1312