novitski / bitcoinj

Automatically exported from code.google.com/p/bitcoinj
Apache License 2.0
0 stars 0 forks source link

ECKey.isCompressed() does not check last byte #411

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In
https://github.com/bitcoin/bitcoin/issues/2699#issuecomment-18461840
laanwj states
"If the length of the key is 33, and the last byte of the private key is 0x01, 
the key is interpreted as compressed. Otherwise, it is treated as uncompressed."

In contrast, ECKey.isCompressed() just checks for length 33, but not if the 
last byte is 1.

Original issue reported on code.google.com by andreas....@gmail.com on 26 May 2013 at 5:02

GoogleCodeExporter commented 9 years ago
Isn't this low hanging fruit for inclusion into 0.9?

Original comment by andreas....@gmail.com on 17 Jun 2013 at 11:18

GoogleCodeExporter commented 9 years ago
ECKey.isCompressed() is correct. What is your concern here? laanwj is talking 
about the private keys. DumpedPrivateKey doesn't check for the trailing 1 
either, but it doesn't really matter at the moment. There's no other value it 
can be. We could add a check for the 1 but it wouldn't fix anything.

Original comment by hearn@google.com on 17 Jun 2013 at 12:27

GoogleCodeExporter commented 9 years ago
My concern is that keys get mixed up between compressed and not (and coins 
lost) - not necessarly now but maybe in future. Anyway, I'll close the issue 
because if you are not concerned, I should not be either (-:

Original comment by andreas....@gmail.com on 17 Jun 2013 at 1:13

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 960bf2626b34.

Original comment by hearn@google.com on 17 Jun 2013 at 1:44