unboundsecurity / blockchain-crypto-mpc

Protecting cryptographic signing keys and seed secrets with Multi-Party Computation.
GNU General Public License v3.0
454 stars 167 forks source link

BIP32 Signing #17

Closed lamnot closed 2 years ago

lamnot commented 3 years ago

Hi,

I am a bit fuzzled about standard signature hash lengths and deriving r and s values. When doing ECDSA signing with a derived BIP32 key, i get variant signature hash lengths, so far have observed 69,70 and 71 lengths......

length 69bytes: b'0C\x02 \x15\x10\xf8D\xf2P\xe2j\xf7\x1d\xa9\x9a|\xe0\xbd\xcdh\x7f\xb5\xfdB&\xf6\x15H\x84\xb6\xc8pG\x1e\x85\x02\x1ff\xb4\x9c\x05\x13O\xa7\x7f\xde\xc0\x14\xdb&\xeb\x80\xacJ\x03\x1cnR\x9a\x99v\x11\x02\xbcb\xe8U\xf3'

length 70bytes: b'0D\x02!\x00\xd3\xfc\xdeT+h\xf5k[\xaa3\x13$r\x17\xd1\xdfe\n\x03\xde=Y\xb0\xc1@\x90\x1a\xac\xc7\x02\x1f):D\xeb\x9b*\xe3:\xcf\xf7\x1a\xefL1%3\x1eN\x0b\xe5\x16\xaa\xb1\x00e\xff\x01\xdf\xdcv\x01'

length 71bytes: b'0E\x02!\x00\xff\xf3>W\x94!\x03\xf6+i\xd6M\#\x8ag;\x96\x9a\xce7\xfa\x95\xf3\xf4@\x11\xccR\xaa\x011\x02s\x94\xbaH\xbb\x04q]T\n\x1f\x1bs!\xe4\x9c\xf2\x14C\x8a\xcd\xbdr\x7fwzR\xd2\x03;\xa7\x88'

.....which doesn't easily fit into the 70bytes to 73 bytes expectation, as follows, and how to get an RLP encoded signature.

6 byte | DER encoding overhead 32 byte | r-value (1 byte) | r-value padding (if needed) 32 byte | S-value (1 byte) | S-value padding (if needed) 1 byte | Signature Hash

Kindly clarify what I am missing.

Additionally, extracting the public key after a generate then derive BIP32 key steps still confusing to me, I get a 176byte output thereafter can't figure out what to do to derive an ethereum address, given that computing an address requires a 64byte public key.

Thank you for the library and the chance to research on mpc crypto operations on blockchains.

Philamericus commented 2 years ago

Hi. On September 1, 2021 we stopped supporting this project, so unfortunately I don't have anyone from the project to answer your question. Sorry!

r4881t commented 2 years ago

hi @lamnot - were you able to figure out a solution/reason for this? I am also running into same.