1
0
Commit Graph

31 Commits

Author SHA1 Message Date
SomberNight
376fc01b27 keystore.sign_message: add optional script_type argument
this is used by trezor
(and also by bitbox02, which was using a workaround previously)

fixes https://github.com/spesmilo/electrum/issues/7670
2022-02-22 19:20:03 +01:00
SomberNight
5cdb4471ec signmessage: also accept Trezor-type sigs for p2wpkh and p2wpkh-p2sh addrs
The signatures we create are unchanged but we now also accept signatures created by Trezor and others.

see https://github.com/spesmilo/electrum/issues/3861
2022-02-16 19:25:46 +01:00
SomberNight
4f9e4c520f ecc: API changes: verify_message_hash to return bool instead of raising
verify_message_hash and verify_message_for_address now return bool
instead of raising Exceptions on bad signatures.
2022-02-16 19:24:38 +01:00
SomberNight
a39bfba2d9 ecc: allow tests to disable ecdsa R-value grinding
see https://github.com/spesmilo/electrum/pull/7453#issuecomment-912594926
2021-09-03 17:18:13 +02:00
SomberNight
9c5e49f432 ecc.ECPubkey: also accept bytearray in __init__
regression since #5947

Traceback (most recent call last):
  File "...\electrum\electrum\base_wizard.py", line 339, in on_device
    self.plugin.setup_device(device_info, self, purpose)
  File "...\electrum\electrum\plugins\ledger\ledger.py", line 598, in setup_device
    client.get_xpub("m/44'/0'", 'standard') # TODO replace by direct derivation once Nano S > 1.1
  File "...\electrum\electrum\plugins\ledger\ledger.py", line 55, in catch_exception
    return func(self, *args, **kwargs)
  File "...\electrum\electrum\plugins\ledger\ledger.py", line 124, in get_xpub
    eckey=ecc.ECPubkey(publicKey),
  File "...\electrum\electrum\ecc.py", line 145, in __init__
    self._x, self._y = _x_and_y_from_pubkey_bytes(b)
  File "...\electrum\electrum\ecc.py", line 119, in _x_and_y_from_pubkey_bytes
    ret = _libsecp256k1.secp256k1_ec_pubkey_parse(
ctypes.ArgumentError: argument 3: <class 'TypeError'>: wrong type
2020-02-19 00:40:33 +01:00
SomberNight
0a5ad9fda4 ecc: small API clean-up 2020-02-11 16:42:02 +01:00
SomberNight
288d793893 ecc: use libsecp256k1 for pubkey recovery (from sig and msg) 2020-02-11 16:41:59 +01:00
SomberNight
ab0c70e291 ecc: use libsecp256k1 for signature conversions
(instead of python-ecdsa)
2020-02-11 16:41:56 +01:00
SomberNight
ad408ea832 ecc: use libsecp256k1 for sign/verify/mul/add 2020-02-11 16:41:52 +01:00
SomberNight
2cf2135528 ecc: abstract away some usage of python-ecdsa: bytes<->int conversions 2020-02-11 16:41:49 +01:00
SomberNight
004acb906d ecc: abstract away some usage of python-ecdsa: randrange 2020-02-11 16:41:45 +01:00
SomberNight
b14747ecfe ecc.ECPubkey: add custom __deepcopy__ implementation
With python-ecdsa 0.15, copy.deepcopy(ecdsa.ecdsa.Public_key) started to raise.
This fixes the Travis test failures.

Also rm unused ECPrivkey._privkey attribute.
2020-01-08 20:09:45 +01:00
SomberNight
5b88b8667e also grind ecdsa low R when using libsecp256k1, and fix tests
note: low R grinding would not have to be duplicated if we trusted the caller
to have done it already (as is the case with the classes in ecc.py), and if
we propagated the choice of "random_k" as part of the nonce_function passed
to libsecp256k1 (which is not currently done)
2019-12-05 20:27:55 +01:00
junderw
d16fd2783c Add signature Low R grinding to match with Bitcoin Core
Ref: https://github.com/bitcoin/bitcoin/pull/13666

Depends on python-ecdsa pull request to allow for extra_entropy
Ref: https://github.com/warner/python-ecdsa/pull/92
2019-12-05 18:11:11 +01:00
SomberNight
bafe8a2fff integrate PSBT support natively. WIP 2019-11-04 22:24:36 +01:00
SomberNight
30bb7dd6f4 ecc: small clean-up 2019-09-18 02:09:15 +02:00
SomberNight
a5b44d25b0 persist channel db on disk. verify channel gossip sigs. 2019-08-20 09:03:10 +02:00
SomberNight
fb00e29f1c bolt-08 handshake must use ephemeral key 2019-08-20 09:03:10 +02:00
ThomasV
0552c61b66 lightning: add payment methods to lnworker 2019-08-20 09:03:09 +02:00
ThomasV
f66377604d fix lnaddr.py following rebase 2019-08-20 09:03:09 +02:00
SomberNight
fd5b1acdc8 commands: fix encrypt/decrypt
based on Electron-Cash/Electron-Cash@62aa08a0ff
2019-05-03 03:10:31 +02:00
SomberNight
3385a94753 logging: basics 2019-05-02 15:19:03 +02:00
SomberNight
85a7aa291e bip32: refactor whole module. clean-up. 2019-02-22 18:50:24 +01:00
SomberNight
53310690a5 version notifications: sig check would always fail on testnet 2019-01-26 15:30:30 +01:00
SomberNight
36f64d1ad9 bitcoin/ecc: some more type annotations 2018-11-18 22:07:27 +01:00
SomberNight
1686a97ece bip70 PRs: use aiohttp instead of requests. use proxy. small fixes. 2018-11-05 19:31:17 +01:00
SomberNight
082a83dd85 rename crypto.Hash to sha256d 2018-10-25 22:28:24 +02:00
SomberNight
1af225015a fix some type annotations involving tuples 2018-10-13 05:16:36 +02:00
SomberNight
ce5cc135cd transaction: make get_address_from_output_script safer
closes #4743
2018-09-29 19:47:55 +02:00
SomberNight
d1f11f5fe9 fix #4717 2018-09-14 16:12:47 +02:00
Janus
097ac144d9 file reorganization with top-level module 2018-07-13 14:01:37 +02:00