-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
added test vector #5 for invalid extended keys #921
Conversation
good point. I might also add some derivation tests that test specifically for leading zeroes in the private key for hardened derivation. So many bigInt libraries in many languages convert to byte arrays with varying lengths and people forget that the ser_key needs to be 32 bytes. For example: btcsuite btcutil ExtendedKey will not derive the following correctly as per this Pull Request: btcsuite/btcutil#161
Would be one such example. |
that is already covered by the test vector 3 added in April 2017 |
If it helps, a test vector is available here, as part of the btclib test suite, namely tested here |
Unless I am missing something, a library not failing at test vector #3 would not fail at this new proposed case: |
is there anything I could do to help this PR being accepted? For a json file of the invalid keys see in the btclib library https://github.com/btclib-org/btclib/blob/master/btclib/tests/test_data/bip32_invalid_keys.json |
The tests for "zero parent fingerprint with non-zero depth" are wrong. There is no reason why fingerprint 0 implies it's a root. |
The BIP32 specification lacks test vectors for invalid extended keys that should not be parsed as valid. Such test vectors are proposed here.
My bad! |
any chance for this to be accepted? |
Needs rebase? |
Rebasing isn't needed assuming the vector # can just be bumped to 5. Just needs @sipa's approval |
Rebased, solving the vector # conflict: if/when approved, this PR can be just squashed&merged |
ACK. See implementation for Bitcoin Core here: bitcoin/bitcoin#22836 |
ACK this found a bug in bitcoin-s |
ACK Implemented in python-bip32, which was too lax on parsing. darosior/python-bip32#17 |
56a42f1 Stricter BIP32 decoding and test vector 5 (Pieter Wuille) Pull request description: This adds detection for various edge cases when decoding BIP32 extended pubkeys/privkeys, and tests them using the proposed bitcoin/bips#921 BIP32 test vector 5. ACKs for top commit: darosior: utACK 56a42f1 -- Had to implement essentially the same fix in python-bip32. kristapsk: ACK 56a42f1. Checked that test vectors are the same as in BIP32 and that tests pass. Tree-SHA512: 5cc800cc9dc10e43ae89b659ce4f44026d04ec3cabac4eb5122d2e72ec2ed66cd5ace8c7502259e469a9ecaa5ecca2457e55dfe5fedba59948ecbf6673af67a7
56a42f1 Stricter BIP32 decoding and test vector 5 (Pieter Wuille) Pull request description: This adds detection for various edge cases when decoding BIP32 extended pubkeys/privkeys, and tests them using the proposed bitcoin/bips#921 BIP32 test vector 5. ACKs for top commit: darosior: utACK 56a42f1 -- Had to implement essentially the same fix in python-bip32. kristapsk: ACK 56a42f1. Checked that test vectors are the same as in BIP32 and that tests pass. Tree-SHA512: 5cc800cc9dc10e43ae89b659ce4f44026d04ec3cabac4eb5122d2e72ec2ed66cd5ace8c7502259e469a9ecaa5ecca2457e55dfe5fedba59948ecbf6673af67a7
9ab2315 Stricter BIP32 decoding and test vector 5 (Kristaps Kaupe) Pull request description: See bitcoin/bips#921 and bitcoin/bitcoin#22836. Top commit has no ACKs. Tree-SHA512: 1e0a44ca0b78f00e9b7779dbdbdbfd7ce46965e04758e2ce4d742ff6dabb6437287b48b470333db0586d3d97ab1907539a395721a3fb419a7c3711f7bf9feae0
56a42f1 Stricter BIP32 decoding and test vector 5 (Pieter Wuille) Pull request description: This adds detection for various edge cases when decoding BIP32 extended pubkeys/privkeys, and tests them using the proposed bitcoin/bips#921 BIP32 test vector 5. ACKs for top commit: darosior: utACK 56a42f1 -- Had to implement essentially the same fix in python-bip32. kristapsk: ACK 56a42f1. Checked that test vectors are the same as in BIP32 and that tests pass. Tree-SHA512: 5cc800cc9dc10e43ae89b659ce4f44026d04ec3cabac4eb5122d2e72ec2ed66cd5ace8c7502259e469a9ecaa5ecca2457e55dfe5fedba59948ecbf6673af67a7
56a42f1 Stricter BIP32 decoding and test vector 5 (Pieter Wuille) Pull request description: This adds detection for various edge cases when decoding BIP32 extended pubkeys/privkeys, and tests them using the proposed bitcoin/bips#921 BIP32 test vector 5. ACKs for top commit: darosior: utACK 56a42f1 -- Had to implement essentially the same fix in python-bip32. kristapsk: ACK 56a42f1. Checked that test vectors are the same as in BIP32 and that tests pass. Tree-SHA512: 5cc800cc9dc10e43ae89b659ce4f44026d04ec3cabac4eb5122d2e72ec2ed66cd5ace8c7502259e469a9ecaa5ecca2457e55dfe5fedba59948ecbf6673af67a7
56a42f1 Stricter BIP32 decoding and test vector 5 (Pieter Wuille) Pull request description: This adds detection for various edge cases when decoding BIP32 extended pubkeys/privkeys, and tests them using the proposed bitcoin/bips#921 BIP32 test vector 5. ACKs for top commit: darosior: utACK 56a42f1 -- Had to implement essentially the same fix in python-bip32. kristapsk: ACK 56a42f1. Checked that test vectors are the same as in BIP32 and that tests pass. Tree-SHA512: 5cc800cc9dc10e43ae89b659ce4f44026d04ec3cabac4eb5122d2e72ec2ed66cd5ace8c7502259e469a9ecaa5ecca2457e55dfe5fedba59948ecbf6673af67a7
The BIP32 specification lacks test vectors for invalid extended keys that should not be parsed as valid. Such test vectors are proposed here.