Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id B66E5CF1 for ; Tue, 19 Feb 2019 00:29:18 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 2110C79 for ; Tue, 19 Feb 2019 00:29:17 +0000 (UTC) Received: by mail-wr1-f41.google.com with SMTP id l5so19177366wrw.6 for ; Mon, 18 Feb 2019 16:29:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8TOwKCKszG7P1VOpqfA+SPElrmyA8xGdaqhtWAcFFYU=; b=JcpGftbZ29Xas31OKNuXUsvsws3Cr/yuP3pEXVPDTo2sIKa+wJFqykR4wWaqvBFVhZ Jeud7aHd5urJF2b3OozXJzf2zHpkVBQxhU4TM5y8qoK1IhaHbHKqjDRBuhdAfOddOY7X LTAw9ODy6IiWicpUYd/UJEivKq960eyccSl6E12lJp2B+FcFeL11LMVv2meeHS6E08Ez DxmfVBpOyRsUBy0v926z4mh2OLnzNiixAG8MRGRdy5p1yZkqnStAiugwcwkRn824sv/7 1mWPIc6SYjCImmj+UJ9jX9a7dC26t9HTs17Vng+o4Gvag8x1uYZ/gyZ1rdRTYokbHQoW xqKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8TOwKCKszG7P1VOpqfA+SPElrmyA8xGdaqhtWAcFFYU=; b=ld3cYuHsRpyjPNvkjRaNRl0wuLPLulkydDgrFuKze21+h7+tajrV6Wms3/liHfXpA0 JYAl0JKERF8LyZb9YLajnkPCP5xacPKdd8J+DMFLcbEBdJTmi4gYxRE5eNqMmpZ4W+PK Dxi7oR8dX8g2cnRLI+7KyOvgI1JrGWD9FMveGgzO4LxLVoEjlf3u1i0VvsWS2xQK24dx +u2pA0c26a0Zk2y4BNXpI8mla8oMS6IhPuuC34lCQsNNWPpz0PofOslZL42Z0iIb4Xuc TEL8tZm0sqWpt+HAqDzg8XKVPir5zHgnNCnsbve4gyo+uVZPZ28Mxy8/vsm+PXVBTazd e9GA== X-Gm-Message-State: AHQUAuYs2EYuJfx4xcpUC0VLbtjZ39U8Z3KrZS19OtRJ263J7k30/t+O QiqCFxlf4DNVlF3wUcy056ATn3zEW2Ps5Rn6bn8= X-Google-Smtp-Source: AHgI3IYWjofisT9lq+lGbfBzewLH4MLA8fmLSzhhITSEyv4FFqdySWrAFtGT2ktX9AZ/oORKPxv2GTY7h0TCTwPpfnc= X-Received: by 2002:adf:9c85:: with SMTP id d5mr4558971wre.68.1550536155609; Mon, 18 Feb 2019 16:29:15 -0800 (PST) MIME-Version: 1.0 References: <5c7fac0f-818b-d78d-5d5f-7a029fdd05ef@gmail.com> <4cfebb7d-42b3-0095-f3ac-dacfff29084d@gmail.com> In-Reply-To: <4cfebb7d-42b3-0095-f3ac-dacfff29084d@gmail.com> From: Christopher Gilliard Date: Mon, 18 Feb 2019 16:29:34 -0800 Message-ID: To: Aymeric Vitte Content-Type: multipart/alternative; boundary="000000000000c4406a058234546b" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org X-Mailman-Approved-At: Wed, 06 Mar 2019 00:22:07 +0000 Cc: Bitcoin Protocol Discussion Subject: Re: [bitcoin-dev] BIP proposal - Signatures of Messages using Bitcoin Private Keys X-BeenThere: bitcoin-dev@lists.linuxfoundation.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Bitcoin Protocol Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 00:29:18 -0000 --000000000000c4406a058234546b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Trying the four possible options (p2pkh compressed, p2pkh uncompressed, seg3, and bech32) is certainly a possibility and in fact, that's what I ended up doing because not every wallet implements something like this, but if there is a header field currently in use, it seemed reasonable to me to use it specify which type of key is being used. If the header includes whether the key is compressed or not compressed it seems logical to include all data about what type of key it is and not just this one type of information. That's why I thought the solution made sense and I wrote it up= . On Mon, Feb 18, 2019 at 3:50 PM Aymeric Vitte wrote: > Ah, OK, that's of course a good thing to document this undocumented (and > strange) stuff, as a matter of fact I implemented it after reading your > post (because this was on my todo list since some time) and got annoyed > quickly, mainly by what is doing formatMessageForSigning (which is quite > trivial when you know it but would be good to document precisely) > > So, yes, it's a good idea to write this, regarding the header I still > don't see the use, testing the different possibilities is not a big deal, > why the signature format is not the same as transactions one is mysteriou= s > too > Le 19/02/2019 =C3=A0 00:24, Christopher Gilliard a =C3=A9crit : > > The proposal includes actual code that does verification, but I didn't > include code for signing. I thought it could be inferred, but I could at > least include a description of how to sign. I am not sure exactly what pa= rt > you are referring to by "keys speech", but the signatures are done by ECD= SA > keys so it's hard to not include anything about keys even though that's n= ot > the main topic. The "Background on ECDSA keys" section was mainly meant t= o > give background about what kind of keys Bitcoin uses, for people who > already know that they can easily skip this section so I would probably > think it's best just to leave in. Maybe it should be at the end as an > addendum though. Yes, I did not invent any of this, I'm just documenting > what people actually seem to do because I had to verify signatures as par= t > of a project I'm working on. I would have liked to have had this document > when I started the project so I thought it might be useful to others sinc= e > as far as I can tell this was not specified anywhere. The reason for > including this data in the header is the same that compressed/uncompresse= d > is included in the header so that you know which type of key the signatur= e > is from and you don't have to try all options to see if any matches. This > is why Trezor did that way and why I documented it. I'm sure there are > other ways to do this, but since this is out there in the field being use= d > and is a reasonable solution, I thought I'd write it up. > > On Mon, Feb 18, 2019 at 2:59 PM Aymeric Vitte > wrote: > >> Then, since you wrote this proposal, maybe you should add the very >> precise description of the signing/verification process since it is >> documented nowhere >> >> I don't get the use of the speech regarding keys while it should focus o= n >> signatures which are summarized in a vague sentence inspired by your ref >> [2] with a not very logical link to the next paragraph stating that r,s >> should be 32B and the whole thing 65B with a header of 1B, you did not >> invent it, that's probably the rule, not sure where it is specified agai= n >> and for what purpose, the header seems completely of no use especially w= hen >> you extend to segwit/bech32 since you just have to check that related >> compressed key matches >> Le 17/02/2019 =C3=A0 15:14, Christopher Gilliard via bitcoin-dev a =C3= =A9crit : >> >> I have written up a proposed BIP. It has to do with Signature formats >> when using Bitcoin Private keys. It is here: >> https://github.com/cgilliard/BIP/blob/master/README.md >> >> This BIP was written up as suggested in this github issue: >> https://github.com/bitcoin/bitcoin/issues/10542 >> >> Note that the proposal is inline with the implementation that Trezor >> implemented in the above issue. >> >> Any feedback would be appreciated. Please let me know what the steps are >> with regards to getting a BIP number assigned or any other process steps >> required. >> >> Regards, >> Chris >> >> _______________________________________________ >> bitcoin-dev mailing listbitcoin-dev@lists.linuxfoundation.orghttps://lis= ts.linuxfoundation.org/mailman/listinfo/bitcoin-dev >> >> -- >> Move your coins by yourself (browser version): https://peersm.com/wallet >> Bitcoin transactions made simple: https://github.com/Ayms/bitcoin-transa= ctions >> Zcash wallets made simple: https://github.com/Ayms/zcash-wallets >> Bitcoin wallets made simple: https://github.com/Ayms/bitcoin-wallets >> Get the torrent dynamic blocklist: http://peersm.com/getblocklist >> Check the 10 M passwords list: http://peersm.com/findmyass >> Anti-spies and private torrents, dynamic blocklist: http://torrent-live.= org >> Peersm : http://www.peersm.com >> torrent-live: https://github.com/Ayms/torrent-live >> node-Tor : https://www.github.com/Ayms/node-Tor >> GitHub : https://www.github.com/Ayms >> >> -- > Move your coins by yourself (browser version): https://peersm.com/wallet > Bitcoin transactions made simple: https://github.com/Ayms/bitcoin-transac= tions > Zcash wallets made simple: https://github.com/Ayms/zcash-wallets > Bitcoin wallets made simple: https://github.com/Ayms/bitcoin-wallets > Get the torrent dynamic blocklist: http://peersm.com/getblocklist > Check the 10 M passwords list: http://peersm.com/findmyass > Anti-spies and private torrents, dynamic blocklist: http://torrent-live.o= rg > Peersm : http://www.peersm.com > torrent-live: https://github.com/Ayms/torrent-live > node-Tor : https://www.github.com/Ayms/node-Tor > GitHub : https://www.github.com/Ayms > > --000000000000c4406a058234546b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Trying the four possible options (p2pkh compressed, p2pkh = uncompressed, seg3, and bech32) is certainly a possibility and in fact, tha= t's what I ended up doing because not every wallet implements something= like this, but if there is a header field currently in use, it seemed reas= onable to me to use it specify which type of key is being used. If the head= er includes whether the key is compressed or not compressed it seems logica= l to include all data about what type of key it is and not just this one ty= pe of information. That's why I thought the solution made sense and I w= rote it up.

On Mon, Feb 18, 2019 at 3:50 PM Aymeric Vitte <vitteaymeric@gmail.com> wrote:
=
=20 =20 =20

Ah, OK, that's of course a good thing to document this undocumented (and strange) stuff, as a matter of fact I implemented it after reading your post (because this was on my todo list since some time) and got annoyed quickly, mainly by what is doing formatMessageForSigning (which is quite trivial when you know it but would be good to document precisely)

So, yes, it's a good idea to write this, regarding the header I still don't see the use, testing the different possibilities is not a big deal, why the signature format is not the same as transactions one is mysterious too

Le 19/02/2019= =C3=A0 00:24, Christopher Gilliard a =C3=A9crit=C2=A0:
=20
The proposal includes actual code that does verification, but I didn't include code for signing. I thought it could be inferred, but I could at least include a description of how to sign. I am not sure exactly what part you are referring to by "keys speech", but the signatures are don= e by ECDSA keys so it's hard to not include anything about keys even though that's not the main topic. The "Background on ECDSA= keys" section was mainly meant to give background about what kind of keys Bitcoin uses, for people who already know that they can easily skip this section so I would probably think it's best just to leave in.=C2=A0 Maybe it should be at the end as an addendu= m though. Yes, I did not invent any of this, I'm just documenting what people actually seem to do because I had to verify signatures as part of a project I'm working on. I would have liked to have had this document when I started the project so I thought it might be useful to others since as far as I can tell this was not specified anywhere. The reason for including this data in the header is the same that compressed/uncompressed is included in the header so that you know which type of key the signature is from and you don't have to try all options to see if any matches. This is why Trezor did that way and why I documented it. I'm sure there are other ways to do this, but since this is out there in the field being used and is a reasonable solution, I thought I'd write it up.

On Mon, Feb 18, 2019 at 2:59 PM Aymeric Vitte <vitteaymeric@gmail.com> wrote:

Then, since you wrote this proposal, maybe you should add the very precise description of the signing/verification process since it is documented nowhere

I don't get the use of the speech regarding keys while i= t should focus on signatures which are summarized in a vague sentence inspired by your ref [2] with a not very logical link to the next paragraph stating that r,s should be 32B and the whole thing 65B with a header of 1B, you did not invent it, that's probably the rule, not sure where it is specified again and for what purpose, the header seems completely of no use especially when you extend to segwit/bech32 since you just have to check that related compressed key matches

Le 17/02/2019 =C3=A0 15:14, Christopher Gilliard via bitcoin-dev= a =C3=A9crit=C2=A0:
I have written up a proposed BIP. It has to do with Signature formats when using Bitcoin Private keys. It is here:=C2=A0https://github= .com/cgilliard/BIP/blob/master/README.md

This BIP was written up as suggested in this github issue:=C2=A0https://github.com/bitcoin/bitcoi= n/issues/10542

Note that the proposal is inline with the implementation that Trezor implemented in the above issue.

Any feedback would be=C2=A0appreciated. Please let m= e know what the steps are with regards to getting a BIP number assigned or any other process steps required.

Regards,
Chris

_______________________________________________
bitcoin-dev mailing list
bitcoin-dev@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listi=
nfo/bitcoin-dev
--=20
Move your coins by yourself (browser version): https://peersm.com/wallet
Bitcoin transactions made simple: https://github.com/Ayms/bitcoin=
-transactions
Zcash wallets made simple: https://github.com/Ayms/zcash-wallets
Bitcoin wallets made simple: https://github.com/Ayms/bitcoin-wallets
Get the torrent dynamic blocklist: http://peersm.com/getblocklist
Check the 10 M passwords list: http://peersm.com/findmyass
Anti-spies and private torrents, dynamic blocklist: http://torrent-live.org
Peersm : http=
://www.peersm.com
torrent-live: https://github.com/Ayms/torrent-live
node-Tor : https://www.github.com/Ayms/node-Tor
GitHub : https://www.github.com/Ayms
--=
=20
Move your coins by yourself (browser version): https://peersm.com/wallet
Bitcoin transactions made simple: https://github.com/Ayms/bitcoin-transactions
Zcash wallets made simple: https://github.com/Ayms/zcash-wallets
Bitcoin wallets made simple: https://github.com/Ayms/bitcoin-wallets
Get the torrent dynamic blocklist: http://peersm.com/getblocklist
Check the 10 M passwords list: ht=
tp://peersm.com/findmyass
Anti-spies and private torrents, dynamic blocklist: http://torrent-live.org
Peersm : http://www.peersm.com
torrent-live: https://gi=
thub.com/Ayms/torrent-live
node-Tor : https://www.g=
ithub.com/Ayms/node-Tor
GitHub : https://www.github.com/A=
yms
--000000000000c4406a058234546b--