Skip to content
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

Bug in EC public key generation #1

Closed
pointbiz opened this issue Sep 20, 2011 · 2 comments
Closed

Bug in EC public key generation #1

pointbiz opened this issue Sep 20, 2011 · 2 comments

Comments

@pointbiz
Copy link

// patched by bitaddress.org and Casascius for use with Bitcoin.ECKey
ECPointFp.prototype.getEncoded = function () {
var x = this.getX().toBigInteger();
var y = this.getY().toBigInteger();
var len = 32; // integerToBytes will zero pad if integer is less than 32 bytes.
//32 bytes length is required by the Bitcoin protocol.
var enc = integerToBytes(x, len);
enc.unshift(0x04);
enc = enc.concat(integerToBytes(y, len));
return enc;
};

The original Tom Wu JSBN Elliptic Curve "ECPointFp.prototype.getEncoded" function uses only the length of the X integer when calling "integerToBytes". For the purposes of the Bitcoin.ECKey library this method should pad zero bytes if the X and/or Y integer is less than 32 bytes.

@casascius
Copy link

This should be considered a critical bug, because its failure mode results in the occasional production of Bitcoin addresses whose funds can never be spent.

@justmoon
Copy link
Member

I updated the builds on NPM and the CDN since this is a critical fix.

kyledrake added a commit that referenced this issue Feb 26, 2014
Fix parsing of base58 compressed private keys. Add base64 parse support.
gskapka referenced this issue in provable-things/liquidjs-lib Jul 9, 2020
* Startup
- Replace all networks.bitcoin occurences with liquid
- Rename package.json and Readme
- Travis

* Rename first integration test

* Fix
gskapka referenced this issue in provable-things/liquidjs-lib Jul 9, 2020
* Fix deps vulnerabilites

* Remove transaction_builder

* Add elements types

* Add elements uspport to Transaction class

* Add tests

* [WIP] Add elements support to psbt module

* Create util bufferReader into bufferutils

* Export Transaction methods

* Add use of BufferWriter & exclude tx.flag if  forSignature is active

* Add elements support to psbt

* Remove logs and add test case

* Lint

* Add deps for integration test

* Add integration test

* Add empty script support to psbt addInput

* Lint

* Add transaction integration test

* Lint

* Minor fix

* Lint

* Add bufferutils unit tests

* Fix for backward compatibility with bitcoinjs

* Add unit tests

* Revert to old variable name

* Rename file

* Add link to tx integration test in readme
junderw pushed a commit that referenced this issue May 24, 2023
Include test for taproot custom signature types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants