summaryrefslogtreecommitdiff
path: root/b9/5d9e448714fd7729bb2d3f3bf0c1e29e561b39
blob: 0df39be2776125b5ab5f4a4325aab1c3859b4f51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191]
	helo=mx.sourceforge.net)
	by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76)
	(envelope-from <nicolas.dorier@gmail.com>) id 1YGWP9-0007QK-Ts
	for bitcoin-development@lists.sourceforge.net;
	Wed, 28 Jan 2015 17:27:51 +0000
Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of gmail.com
	designates 74.125.82.46 as permitted sender)
	client-ip=74.125.82.46; envelope-from=nicolas.dorier@gmail.com;
	helo=mail-wg0-f46.google.com; 
Received: from mail-wg0-f46.google.com ([74.125.82.46])
	by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128)
	(Exim 4.76) id 1YGWP7-0006EW-UD
	for bitcoin-development@lists.sourceforge.net;
	Wed, 28 Jan 2015 17:27:51 +0000
Received: by mail-wg0-f46.google.com with SMTP id l2so21940687wgh.5
	for <bitcoin-development@lists.sourceforge.net>;
	Wed, 28 Jan 2015 09:27:44 -0800 (PST)
MIME-Version: 1.0
X-Received: by 10.194.2.178 with SMTP id 18mr9553575wjv.67.1422466064857; Wed,
	28 Jan 2015 09:27:44 -0800 (PST)
Sender: slashene@gmail.com
X-Google-Sender-Delegation: slashene@gmail.com
Received: by 10.194.92.112 with HTTP; Wed, 28 Jan 2015 09:27:44 -0800 (PST)
In-Reply-To: <CANEZrP3ta59A0Fr9-afd1ByQ7U0G7kQVu_EsK-8AZkud74Kxpw@mail.gmail.com>
References: <CALYO6Xt-jTYwpywUaH-s4YPYyGUp1_BLSEswscnwX+Vu166Lcw@mail.gmail.com>
	<alpine.DEB.2.10.1501281419110.21680@nzrgulfg.ivfhpber.pbz>
	<CALYO6Xv=k+Ztvke90SDB91StFBL7C0U49ufMD-WjG91uHLshFg@mail.gmail.com>
	<CANEZrP3PCHaTO3-HA3GHFxwuJJpW2dbvPuV4R1sFPcFW49uGgw@mail.gmail.com>
	<CALYO6Xucf7xqE_4ykJqFyS_AEAT0X-1aGvYmA0WXzX7By0c0uQ@mail.gmail.com>
	<CANEZrP1N4nwATG2FNJwc8jHZg3HfjSxHOL0u84jTi7Tx0+d9dQ@mail.gmail.com>
	<CA+1nnr=5PVhME1nZz=5Ki9SXH4Ok=pamDSGr_8Pz6nzyM9SRbQ@mail.gmail.com>
	<CANEZrP3ta59A0Fr9-afd1ByQ7U0G7kQVu_EsK-8AZkud74Kxpw@mail.gmail.com>
Date: Wed, 28 Jan 2015 18:27:44 +0100
X-Google-Sender-Auth: 2HlGphfTITnfiCl8yzZ2Tb3vRkc
Message-ID: <CALYO6XtG41q4UB1SYcGyM1JdG_iJJsO_A8DicHe8=2hW4i=4FQ@mail.gmail.com>
From: Nicolas DORIER <nicolas.dorier@gmail.com>
To: Mike Hearn <mike@plan99.net>
Content-Type: multipart/alternative; boundary=047d7b3a86ba803e59050db9b053
X-Spam-Score: -0.6 (/)
X-Spam-Report: Spam Filtering performed by mx.sourceforge.net.
	See http://spamassassin.org/tag/ for more details.
	-1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for
	sender-domain
	0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
	(nicolas.dorier[at]gmail.com)
	-0.0 SPF_PASS               SPF: sender matches SPF record
	1.0 HTML_MESSAGE           BODY: HTML included in message
	-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from
	author's domain
	0.1 DKIM_SIGNED            Message has a DKIM or DK signature,
	not necessarily valid
	-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
X-Headers-End: 1YGWP7-0006EW-UD
Cc: Bitcoin Dev <bitcoin-development@lists.sourceforge.net>
Subject: Re: [Bitcoin-development] BIP70: why Google Protocol Buffers for
	encoding?
X-BeenThere: bitcoin-development@lists.sourceforge.net
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: <bitcoin-development.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=bitcoin-development>
List-Post: <mailto:bitcoin-development@lists.sourceforge.net>
List-Help: <mailto:bitcoin-development-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=subscribe>
X-List-Received-Date: Wed, 28 Jan 2015 17:27:52 -0000

--047d7b3a86ba803e59050db9b053
Content-Type: text/plain; charset=UTF-8

Sure,

But the mobile targets, it is still easier to use Json + HTTPS, especially
when you want one code base for everything.
And as you said, developers need to think about fetching mozilla store time
to time, and check revocations themselves. This is not obvious thing to do,
and hard to test correctly.

If your use case was the primary utility of BIP70, then I'd say it fit the
bill. But for cross plateform client development an atlernative would be
easier.

> why not allow both serializations and keep serialization format a
parameter, keep everyone happy.

It would be another BIP, because if we use JSON with HTTPS, the difference
is also in the semantic (no embedded certificates)

I will likely provide this option for a product I am developing. I will
only use another Content Type. We'll see then how it goes.

2015-01-28 18:14 GMT+01:00 Mike Hearn <mike@plan99.net>:

> I think we'll just have to agree to disagree on this one. I've implemented
> BIP70 a couple of times now and didn't find it to be difficult. I know you
> had odd problems with the C# protobuf implementation you were using but
> library bugs can happen for any kind of programming.
>
> I forgot to mention the other reason it's done this way. One of the
> driving goals of BIP70 was to support the TREZOR and similar devices. For
> hardware wallets, it's critical to keep the amount of code they need to run
> as small as possible. Any bugs in the code there can cause security holes
> and lead to the device being hacked.
>
> Doing it the way you suggest would mean the secure code would have to
> contain complex and bug-prone text parsing logic as well as a full blown
> HTTP and SSL stack, that requires not only X.509 handling but also lots of
> other stuff on top. It'd increase cost, complexity and decrease security
> quite a bit.
>
> Whilst I appreciate if your platform provides a scripting-like API and
> nothing low level it might seem easier to use JSON+HTTPS, that isn't the
> case for one of the primary design targets.
>
>
>
> On Wed, Jan 28, 2015 at 6:04 PM, Nicolas Dorier <nicolas.dorier@gmail.com>
> wrote:
>
>> Mike, I am not denying it is impossible to do all of that.
>> Just that it is not a trivial stuff to do to make it works everywhere,
>> and I think that it is not a good thing for a client side technology.
>> BIP70 has its use, and I understand why there is case where it is good to
>> ship the certs in the message and not depends on the transport.
>>
>> But a standard that just use JSON and HTTPS, even if less flexible that
>> BIP70, would make it easier and sufficient for today's use case.
>>
>> On Wed, Jan 28, 2015 at 5:55 PM, Mike Hearn <mike@plan99.net> wrote:
>>
>>> My point is not that there is a limitation in BIP70. My point is that
>>>> you put the burden of certificate verification on developer's shoulder when
>>>> we can just leverage built in HTTPS support of the platform.
>>>>
>>>
>>> Platforms that support HTTPS but not certificate handling are rare - I
>>> know HTML5 is such a platform but such apps are inherently dependent on the
>>> server anyway and the server can just do the parsing and validation work
>>> itself. If WinRT is such a platform, OK, too bad.
>>>
>>> The embedding of the certificates is not arbitrary or pointless, by the
>>> way. It's there for a very good reason - it makes the signed payment
>>> request verifiable by third parties. Effectively you can store the signed
>>> message and present it later to someone else, it's undeniable. Combined
>>> with the transactions and merkle branches linking them to the block chain,
>>> what you have is a form of digital receipt ... a proof of purchase that can
>>> be automatically verified as legitimate. This has all kinds of use cases.
>>>
>>> Because of how HTTPS works, you can't easily prove to a third party that
>>> a server gave you a piece of data. Doing so requires staggeringly complex
>>> hacks (see tls notary) and when we designed BIP70, those hacks didn't even
>>> exist. So we'd lose the benefit of having a digitally signed request.
>>>
>>> Additionally, doing things this way means BIP70 requests can be signed
>>> by things which are not HTTPS servers. For example you can sign with an
>>> email address cert, an EV certificate i.e. a company, a certificate issued
>>> by some user forum, whatever else we end up wanting. Not every payment
>>> recipient can be identified by a domain name + dynamic session.
>>>
>>>
>>>> However, if you want to use your plateform's store, then you are toasted
>>>>
>>>
>>> That's a bit melodramatic. BitcoinJ is able to use the Android, JRE,
>>> Windows and Mac certificate stores all using the same code or very minor
>>> variants on it (e.g. on Mac you have to specify you want the system store
>>> but it's a one-liner).
>>>
>>> Yes, that's not *every* platform. Some will require custom binding glue
>>> and it depends what abstractions and languages you are using.
>>>
>>>
>>>> Have you tried to do that on windows RT and IOS ? I tried, and I
>>>> quickly stopped doing that since it is not worth the effort. (Frankly I am
>>>> not even sure you can on win rt, since the API is a stripped down version
>>>> of windows)
>>>>
>>>
>>> There is code to do iOS using the Apple APIs here:
>>>
>>>
>>> https://github.com/voisine/breadwallet/blob/master/BreadWallet/BRPaymentProtocol.m#L391
>>>
>>>
>>>> Why have you not heard about the problem ? (until now, because I have
>>>> this problem because I need to have the same codebase on
>>>> winrt/win/android/ios/tablets)
>>>>
>>>
>>> WinRT is a minority platform in the extreme, and all the other platforms
>>> you mentioned have the necessary APIs. Java abstracts you from them. So I
>>> think you are encountering this problem because you desire to target WinRT
>>> and other platforms with a single codebase. That's an unusual constraint.
>>>
>>> AFAIK the only other people who encountered this are BitPay, because
>>> they want to do everything in Javascript which doesn't really provide any
>>> major APIs.
>>>
>>>
>>>> Also, you bundle mozilla's store in bitcoinj, what happen when the
>>>> store change and your customer have not intent to use bitcoinj new version
>>>> ? by leveraging the plateform you benefit from automatic updates.
>>>>
>>>
>>> Yes, there are pros and cons to bundling a custom root store.
>>>
>>>
>>>> Also, does java stores deals with certificate revocations ? sure you
>>>> can theorically code that too... or just let the plateform deals with it.
>>>>
>>>
>>> It can do OCSP checks, yes, although I believe no wallets currently do
>>> so. A better solution would be to implement an OCSP stapling extension to
>>> BIP70 though.
>>>
>>
>>
>

--047d7b3a86ba803e59050db9b053
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><div><div><div><div>Sure,<br><br></div>But the mobile=
 targets, it is still easier to use Json + HTTPS, especially when you want =
one code base for everything.<br></div>And as you said, developers need to =
think about fetching mozilla store time to time, and check revocations them=
selves. This is not obvious thing to do, and hard to test correctly.<br></d=
iv><br>If your use case was the primary utility of BIP70, then I&#39;d say =
it fit the bill. But for cross plateform client development an atlernative =
would be easier.<br><br>&gt; why not allow both serializations and keep ser=
ialization format a parameter, keep everyone happy.<br><br></div>It would b=
e another BIP, because if we use JSON with HTTPS, the difference is also in=
 the semantic (no embedded certificates)<br><br></div>I will likely provide=
 this option for a product I am developing. I will only use another Content=
 Type. We&#39;ll see then how it goes.<br></div><div class=3D"gmail_extra">=
<br><div class=3D"gmail_quote">2015-01-28 18:14 GMT+01:00 Mike Hearn <span =
dir=3D"ltr">&lt;<a href=3D"mailto:mike@plan99.net" target=3D"_blank">mike@p=
lan99.net</a>&gt;</span>:<br><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr=
">I think we&#39;ll just have to agree to disagree on this one. I&#39;ve im=
plemented BIP70 a couple of times now and didn&#39;t find it to be difficul=
t. I know you had odd problems with the C# protobuf implementation you were=
 using but library bugs can happen for any kind of programming.<div><br></d=
iv><div>I forgot to mention the other reason it&#39;s done this way. One of=
 the driving goals of BIP70 was to support the TREZOR and similar devices. =
For hardware wallets, it&#39;s critical to keep the amount of code they nee=
d to run as small as possible. Any bugs in the code there can cause securit=
y holes and lead to the device being hacked.</div><div><br></div><div>Doing=
 it the way you suggest would mean the secure code would have to contain co=
mplex and bug-prone text parsing logic as well as a full blown HTTP and SSL=
 stack, that requires not only X.509 handling but also lots of other stuff =
on top. It&#39;d increase cost, complexity and decrease security quite a bi=
t.</div><div><br></div><div>Whilst I appreciate if your platform provides a=
 scripting-like API and nothing low level it might seem easier to use JSON+=
HTTPS, that isn&#39;t the case for one of the primary design targets.</div>=
<div><br></div><div><br></div></div><div class=3D"gmail_extra"><br><div cla=
ss=3D"gmail_quote">On Wed, Jan 28, 2015 at 6:04 PM, Nicolas Dorier <span di=
r=3D"ltr">&lt;<a href=3D"mailto:nicolas.dorier@gmail.com" target=3D"_blank"=
>nicolas.dorier@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gma=
il_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-lef=
t:1ex"><div dir=3D"ltr"><div><div><div>Mike, I am not denying it is impossi=
ble to do all of that.<br></div>Just that it is not a trivial stuff to do t=
o make it works everywhere, and I think that it is not a good thing for a c=
lient side technology.<br></div>BIP70 has its use, and I understand why the=
re is case where it is good to ship the certs in the message and not depend=
s on the transport.<br><br></div>But a standard that just use JSON and HTTP=
S, even if less flexible that BIP70, would make it easier and sufficient fo=
r today&#39;s use case.<br></div><div><div class=3D"h5"><div><div><div clas=
s=3D"gmail_extra"><br><div class=3D"gmail_quote">On Wed, Jan 28, 2015 at 5:=
55 PM, Mike Hearn <span dir=3D"ltr">&lt;<a href=3D"mailto:mike@plan99.net" =
target=3D"_blank">mike@plan99.net</a>&gt;</span> wrote:<br><blockquote clas=
s=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;pad=
ding-left:1ex"><div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gm=
ail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.=
8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-st=
yle:solid;padding-left:1ex"><div dir=3D"ltr"><div><div><div><div><div><div>=
<div>My point is not that there is a limitation in BIP70. My point is that =
you put the burden of certificate verification on developer&#39;s shoulder =
when we can just leverage built in HTTPS support of the platform.<br></div>=
</div></div></div></div></div></div></div></blockquote><div><br></div><div>=
Platforms that support HTTPS but not certificate handling are rare - I know=
 HTML5 is such a platform but such apps are inherently dependent on the ser=
ver anyway and the server can just do the parsing and validation work itsel=
f. If WinRT is such a platform, OK, too bad.</div><div><br></div><div>The e=
mbedding of the certificates is not arbitrary or pointless, by the way. It&=
#39;s there for a very good reason - it makes the signed payment request ve=
rifiable by third parties. Effectively you can store the signed message and=
 present it later to someone else, it&#39;s undeniable. Combined with the t=
ransactions and merkle branches linking them to the block chain, what you h=
ave is a form of digital receipt ... a proof of purchase that can be automa=
tically verified as legitimate. This has all kinds of use cases.=C2=A0</div=
><div><br></div><div>Because of how HTTPS works, you can&#39;t easily prove=
 to a third party that a server gave you a piece of data. Doing so requires=
 staggeringly complex hacks (see tls notary) and when we designed BIP70, th=
ose hacks didn&#39;t even exist. So we&#39;d lose the benefit of having a d=
igitally signed request.</div><div><br></div><div>Additionally, doing thing=
s this way means BIP70 requests can be signed by things which are not HTTPS=
 servers. For example you can sign with an email address cert, an EV certif=
icate i.e. a company, a certificate issued by some user forum, whatever els=
e we end up wanting. Not every payment recipient can be identified by a dom=
ain name + dynamic session.</div><div>=C2=A0</div><blockquote class=3D"gmai=
l_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-lef=
t-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir=
=3D"ltr"><div><div><div><div><div><div><div></div></div></div>However, if y=
ou want to use your plateform&#39;s store, then you are toasted</div></div>=
</div></div></div></blockquote><div><br></div><div>That&#39;s a bit melodra=
matic. BitcoinJ is able to use the Android, JRE, Windows and Mac certificat=
e stores all using the same code or very minor variants on it (e.g. on Mac =
you have to specify you want the system store but it&#39;s a one-liner).=C2=
=A0</div><div><br></div><div>Yes, that&#39;s not <i>every</i>=C2=A0platform=
. Some will require custom binding glue and it depends what abstractions an=
d languages you are using.</div><div>=C2=A0</div><blockquote class=3D"gmail=
_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left=
-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir=
=3D"ltr"><div><div><div><div>Have you tried to do that on windows RT and IO=
S ? I tried, and I quickly stopped doing that since it is not worth the eff=
ort. (Frankly I am not even sure you can on win rt, since the API is a stri=
pped down version of windows)<br></div></div></div></div></div></blockquote=
><div><br></div><div>There is code to do iOS using the Apple APIs here:</di=
v><div><br></div><div><a href=3D"https://github.com/voisine/breadwallet/blo=
b/master/BreadWallet/BRPaymentProtocol.m#L391" target=3D"_blank">https://gi=
thub.com/voisine/breadwallet/blob/master/BreadWallet/BRPaymentProtocol.m#L3=
91</a><br></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D=
"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,2=
04,204);border-left-style:solid;padding-left:1ex"><div dir=3D"ltr"><div><di=
v><div><div></div></div>Why have you not heard about the problem ? (until n=
ow, because I have this problem because I need to have the same codebase on=
 winrt/win/android/ios/tablets)<br></div></div></div></blockquote><div><br>=
</div><div>WinRT is a minority platform in the extreme, and all the other p=
latforms you mentioned have the necessary APIs. Java abstracts you from the=
m. So I think you are encountering this problem because you desire to targe=
t WinRT and other platforms with a single codebase. That&#39;s an unusual c=
onstraint.</div><div><br></div><div><div>AFAIK the only other people who en=
countered this are BitPay, because they want to do everything in Javascript=
 which doesn&#39;t really provide any major APIs.</div></div><div>=C2=A0</d=
iv><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bord=
er-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:soli=
d;padding-left:1ex"><div dir=3D"ltr"><div><div></div></div><div>Also, you b=
undle mozilla&#39;s store in bitcoinj, what happen when the store change an=
d your customer have not intent to use bitcoinj new version ? by leveraging=
 the plateform you benefit from automatic updates.<br></div></div></blockqu=
ote><div><br></div><div>Yes, there are pros and cons to bundling a custom r=
oot store.</div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D=
"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,2=
04,204);border-left-style:solid;padding-left:1ex"><div dir=3D"ltr"><div></d=
iv><div>Also, does java stores deals with certificate revocations ? sure yo=
u can theorically code that too... or just let the plateform deals with it.=
<br></div></div></blockquote><div><br></div><div>It can do OCSP checks, yes=
, although I believe no wallets currently do so. A better solution would be=
 to implement an OCSP stapling extension to BIP70 though.</div></div></div>=
</div>
</blockquote></div><br></div>
</div></div></div></div></blockquote></div><br></div>
</blockquote></div><br></div>

--047d7b3a86ba803e59050db9b053--