bitcoinlib icon indicating copy to clipboard operation
bitcoinlib copied to clipboard

Using BIP38 encrypted Private Key throw error

Open alex-frx opened this issue 1 year ago • 1 comments
trafficstars

When using a BIP38 encrypted Private Key I get an: EncodingError: Unrecognised password protected key format. Flagbyte incorrect. Error

Minimal example:

from bitcoinlib.keys import Address,Key

public_address = "1CTHRG6Te7dvbb5RQ6JuDv6tNdMH6Fahic"
private_key = "6PnV1MS7UY4wjdAGucW2MdTuDNiTvQPthTjiMex6HNv2NfLXLk8CKQfCnL"
password = "hallohallo"

key = Key(private_key, password=password)
print(key.info())

The pair were generated using bitaddress.org

or am I using it wrong

alex-frx avatar Jan 09 '24 11:01 alex-frx

EC multiplied BIP38 addresses are not supported at the moment. For now I made commit https://github.com/1200wd/bitcoinlib/commit/fe5f9b60d694cda59ab51544164cc329e2dbdd52 to raise a more informative error.

mccwdev avatar Jan 15 '24 13:01 mccwdev

Added EC multiplied keys in release 0.7 and commit 7b1c01607f5231213ec0c26415ea91efeecdd6e4

mccwdev avatar Mar 13 '24 15:03 mccwdev