Korben00 / bitcoin-recovery

This Python script is a useful tool for cryptocurrency enthusiasts. It recovers Bitcoin private keys from public keys.
MIT License
9 stars 4 forks source link

Not compatible with some public keys #2

Open antonio-fr opened 1 year ago

antonio-fr commented 1 year ago

Works great. But it is not compatible when the public key contains the sequence "f001".

Please enter your Bitcoin public key: 0237645385dacc91e96285b1a446d7ebfc5e32dad2f43ec9a083c5764d1e73d31d
"Generating your private key in progress... : ...
Found : 0xbb5a192e7459b8bd8c00676477c4114841c3101a4dde01049de8a22e77d85b5a

With a public key with the given value affected.

Please enter your Bitcoin public key: 0317FD4F5A289FDCF001277D289D1767AEC52DF9B70DD81FB5BB111E969D940E91
Traceback (most recent call last):
  File "C:\work\bitcoin_recovery.py", line 109, in <module>
    pk.recover(bytes.fromhex(pub_hex), sha2(data), ec.ECDSA(hashes.SHA256()))
  File "C:\Python\lib\site-packages\cryptography\hazmat\backends\openssl\ec.py", line 315, in recover
    _ecdsa_sig_recover(self._backend, self, public_key, data)
  File "C:\Python\lib\site-packages\cryptography\hazmat\backends\openssl\ec.py", line 122, in _ecdsa_sig_recover
    raise InvalidPublicKey
Korben00 commented 1 year ago

Hi there,

Thank you for reporting this issue, and I'm glad to hear that the tool has been working well for you otherwise.

Based on the error message you provided, it seems that the problem is related to the cryptography library, specifically when attempting to recover the public key with the given value affected by the sequence "f001". The error InvalidPublicKey is raised, which indicates that the public key is not valid in this specific case.

To better understand and resolve this issue, I would recommend trying the following steps:

Ensure that you are using the latest version of the cryptography library. You can update it using the following command:

pip install --upgrade cryptography

Verify that the public key containing the "f001" sequence is indeed a valid public key. If it's not valid, you might want to double-check the input or how the public key was generated. If the issue persists even after updating the library and verifying the public key, please provide more information on how the public key was generated and any additional context about the "f001" sequence. This will help me better understand the issue and provide a more specific solution. Once again, thank you for your feedback, and I hope these steps help resolve the issue. If you have any further questions or concerns, please don't hesitate to let me know.

Best regards, Korben