HomePhabricator

[electrum] fix hardware wallet decryption

Description

[electrum] fix hardware wallet decryption

Summary:
Wallets are encrypted with a key derived from a password. Hardware wallets use a hex-encoded public key generated by the device on a special derivation path as the password.

With the recent refactorings, Xpub.get_pubkey_from_xpub now returns bytes, so we need to explicitely convert it to a hex string before passing it to storage.decrypt.

Note that this was already fixed in HardwareKeyStore.get_password_for_storage_encryption which is called when the wallet is first created, so any wallet created by Electrum ABC 5.2.8 will be correctly encrypted. The bug affect the decryption when the user tries to reopen the wallet later.

Test Plan: Open an encrypted hardware wallet. Tested with a Ledger Nano S and a Satochip card.

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D14645

Details

Provenance
PiRKAuthored on Oct 18 2023, 04:54
PiRKPushed on Oct 18 2023, 08:26
Reviewer
Restricted Project
Differential Revision
D14645: [electrum] fix hardware wallet decryption
Parents
rABC6722d8264193: Fix chain tip data race and corrupt rest response
Branches
Unknown
Tags
Unknown