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

Add support for Satochip hardware wallet #7518

Closed
wants to merge 51 commits into from

Conversation

Toporin
Copy link
Contributor

@Toporin Toporin commented Sep 29, 2021

This is a pull request to add support for the Satochip hardware wallet.

The Satochip hardware wallet is based on a jacavard smartcard and is fully open-source.
The wallet is composed of a javacard applet (https://github.com/Toporin/SatochipApplet) that is to be loaded on the smartcard, and an Electrum client plugin (https://github.com/Toporin/electrum-satochip) that acts as the interface between the card and the network. An optional 2FA setting allows to confirm transaction requests on a second android device before signing them.

This pull request supersedes #6520. Changes compared to previous PR:

  • support for latest Electrum v4.1.5 instead of v4.0.2
  • use pysatochip v0.12.3
  • suport for Satochip applet up to v0.12 (instead of v0.11)

New functionalities in Satochip applet v0.12:

  • Card authenticity verification based on device certificate & PKI
  • Reset to factory option (e.g. if user forget his PIN code or 2FA device)
  • Support for importing encrypted seed from a SeedKeeper

More info:
https://github.com/Toporin/ (official repository)
https://pypi.org/project/pysatochip/ (pysatochip library)
https://prezi.com/p/mpq-xhh3mxjl/satochip-gent-meetup/ (Slides from previous meetups in Belgium)
https://t.me/Satochip (Telegram support)

Alcofribas4 and others added 30 commits December 18, 2018 12:17
Basic Satochip plugin functionnal
No SegWit support yet
- parse segwit tx
- sign tx

Electrum-Satochip integration:
- store authentikey in (encrypted) storage
- Device setup: prompt for PIN & Seed
Check Satochip version for support via card_get_status()
* Refactor card_bip32_import_seed() and card_bip32_get_authentikey(): return authentikey instead of (response, sw1, sw2)
* New class UninitializedSeedError(Exception) thrown when device has no seed
…e) directly

remove debug comments and clean code a bit
# Conflicts:
#	contrib/build-osx/make_osx
#	contrib/build-osx/osx.spec
#	contrib/build-osx/package.sh
#	contrib/build-wine/build-electrum-git.sh
#	contrib/build-wine/build-secp256k1.sh
#	contrib/build-wine/build.sh
#	contrib/build-wine/deterministic.spec
#	contrib/build-wine/prepare-wine.sh
#	contrib/build-wine/sign.sh
#	contrib/build-wine/unsign.sh
#	contrib/deterministic-build/check_submodules.sh
#	contrib/deterministic-build/find_restricted_dependencies.py
#	contrib/freeze_packages.sh
#	contrib/make_apk
#	contrib/make_download
#	contrib/make_locale
#	contrib/make_packages
#	contrib/make_tgz
#	contrib/sign_packages
#	contrib/upload
#	electrum
#	electrum-env
#	gui/kivy/data/fonts/tron/License.txt
#	gui/kivy/data/fonts/tron/Readme.txt
#	lib/base_wizard.py
#	lib/crypto.py
#	lib/plugins.py
#	lib/ripemd.py
#	lib/wordlist/portuguese.txt
#	plugins/trezor/trezor.py
#	scripts/bip70
#	scripts/block_headers
#	scripts/estimate_fee
#	scripts/get_history
#	scripts/peers
#	scripts/servers
#	scripts/txradar
#	scripts/watch_address
#	setup.py

Signed-off-by: Baudoin <bcollard@gmail.com>
various code cleaning,
set random PIN for unused pin/puk code
* card_get_status() returns number of pin/puk tries remaining
* PIN verification is refactored in card_verify_PIN()
Merge commit '87c596fa1d685b9365c26b9dfabe9c566f806ea0' into satochip

# Conflicts:
#	.gitignore
#	README.rst
#	contrib/build-linux/appimage/apprun.sh
#	contrib/build-linux/appimage/build.sh
#	contrib/build-osx/osx.spec
#	contrib/build-wine/build-electrum-git.sh
#	contrib/build-wine/deterministic.spec
#	contrib/build-wine/prepare-wine.sh
#	contrib/build_tools_util.sh
#	contrib/osx/make_osx
#	contrib/sign_version
#	electrum/base_wizard.py
#	electrum/plugin.py
#	icons.qrc
#	lib/crypto.py
In CardConnector.py:
- Encrypt/decrypt 2FA challenge/response for privacy
- erase PIN when card is removed

In Satochip.py:
- pairing with 2FA device using QR code
- if 2FA is enabled, tx signing requires response to challenge using hmac-sha1

New plugin in satochip_2FA folder: exchange challenge-response with 2FA device

Minor changes in TxParser.py, plugin.py
Merge remote-tracking branch 'upstream/master' into satochip

# Conflicts:
#	.gitignore
#	README.rst
#	contrib/build-wine/build-electrum-git.sh
#	contrib/build-wine/prepare-wine.sh
#	electrum/base_wizard.py
#	electrum/plugin.py
- contrib/build-wine/LICENCE
- contrib/build-wine/tmp/electrum/
- contrib/osx/package.sh~HEAD
- removed README-electrum.rst
- undo changes to README.rst
- removed debug traces in contrib/build-wine/deterministic.spec
- add pyscard in contrib/requirements/requirements-hw.txt
Merge branch 'Electrum-Satochip-v3.3.8-0.7' into satochip:
    - removed README-electrum.rst
    - undo changes to README.rst
    - removed debug traces in contrib/build-wine/deterministic.spec
    - add pyscard in contrib/requirements/requirements-hw.txt
Support for Satochip v0.8 (improved 2-Factor-Authentication support):
* A new setting menu is available when clicking on the satochip logo in the low right corner of the window.
* Add support for PIN change and seed reset
* In addition to transactions, 2FA is now required to sign messages, import eckey and reset seed/eckey/2FA.
* 2FA can be disabled, only when the seed and all private keys are cleared.

Added support for Satochip in AppImage.
To run the AppImage on Linux:
$ chmod a+x electrum*.AppImage
$ ./electrum*.AppImage
Support for Satochip v0.8 (improved 2-Factor-Authentication support):
  * A new setting menu is available when clicking on the satochip logo in the low right corner of the window.
  * Add support for PIN change and seed reset
  * In addition to transactions, 2FA is now required to sign messages, import eckey and reset seed/eckey/2FA.
  * 2FA can be disabled, only when the seed and all private keys are cleared.

Added support for Satochip in AppImage.
To run the AppImage on Linux:
  $ chmod a+x electrum*.AppImage
  $ ./electrum*.AppImage

Merge branch 'electrum-satochip-v3.3.8-0.8' into satochip
Support for the Satochip v0.9
Patch: message signing for Litecoin (and other alts)
No impact for Bitcoin
Support for the Satochip v0.9
Patch: message signing for Litecoin (and other alts)
No impact for Bitcoin

Merge branch 'electrum-satochip-v3.3.8-0.9' into satochip
see:
Electron-Cash#1712
Electron-Cash#1713
(cherry picked from commit faf585e)

# Conflicts:
#	electrum/plugins/satochip/qt.py
#	electrum/plugins/satochip/satochip.py
…tikey" error

When using passphrase with seed, I am sometimes getting an error: Recovered authentikey does not correspond to registered authentikey!
See simpleledger#101 (comment)

(cherry picked from commit c2d2828)

# Conflicts:
#	electrum/plugins/satochip/CardConnector.py
#	electrum/plugins/satochip/CardDataParser.py
#	electrum/plugins/satochip/satochip.py
Merge remote-tracking branch 'electrum/master' into electrum-satochip-v4.0.0a0-0.9-dev1

# Conflicts:
#	contrib/build-linux/appimage/Dockerfile
Merge branch 'electrum-satochip-v4.0.0a0-0.9' into satochip
* Electrum v4.0.2 with satochip plugin
* Use pysatochip v0.11.2 with secure channel support
* When generating a new seed: create BIP39 seeds instead of Electrum seeds
* When importing an existing seed, it is recommended to import a BIP39 seeds

Rationale is detailed here: spesmilo#6520 (comment)
* Compared to v0.11.2, pysatochip v0.11.3 adds support for altcoin message signing in CardConnector.card_sign_message()
* Switch to BIP39 seeds by default for Satochip instead of Electrum seeds
* Bump pysatochip version to v0.11.3 from v0.11.2
# Conflicts:
#	contrib/build-wine/prepare-wine.sh
#	contrib/deterministic-build/requirements-hw.txt
#	contrib/requirements/requirements-hw.txt
* Merge branch 'master' into electrum-satochip-v4.0.2-0.11
* Bump pysatochip version to v0.11.4 from v0.11.3
* Add 'enable 2FA' and 'disable 2FA' buttons in Satochip plugin options
* In has_usable_connection_with_device(), replace card_select() with card_get_ATR() for efficiency

# Conflicts:
#	contrib/deterministic-build/requirements-hw.txt
#	contrib/requirements/requirements-hw.txt
- bump pysatochip lib to v0.12.3
- add support for new features: label & card authenticity
- Update dockerfile
- Update python to v3.8.8
- Update pyscard to v2.0.0 & use Pypi repository
Branch electrum-satochip-v4.0.9-0.12 is based on Electrum v4.0.9 with added support for Satochip applet v0.12.
Merge branch 'master' into electrum-satochip-v4.1.5-0.12

# Conflicts:
#	contrib/build-linux/appimage/Dockerfile
#	contrib/build-wine/prepare-wine.sh
#	contrib/deterministic-build/requirements-hw.txt
#	contrib/requirements/requirements-hw.txt
@Toporin
Copy link
Contributor Author

Toporin commented Mar 2, 2022

This pull request was superseded by #7690.

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

Successfully merging this pull request may close these issues.

None yet

2 participants