<oembed><type>rich</type><version>1.0</version><author_name>npub10r66s2stvnancx9axwnfc5a34asjkwkgmkq7ztm5hf30x7fa4szsv9afdw</author_name><author_url>https://nostr.ae/npub10r66s2stvnancx9axwnfc5a34asjkwkgmkq7ztm5hf30x7fa4szsv9afdw</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2021-02-14&#xA;📝 Original message:I think that it is better to issue individual TOKEN for each&#xA;participant. Otherwise it will be possible for one participant to&#xA;attack another (intercept and replace their xpub sent to the&#xA;coordinator).&#xA;&#xA;It will also be convenient to have a public &#39;participant id&#39;, derived&#xA;from the token. It can be derived from the same token, but with&#xA;different (but fixed) `Pwd`. With unique token per participant, such&#xA;derivation will uniquely identify each participant, so the coordinator&#xA;won&#39;t need to try all the tokens to decrypt the data.&#xA;&#xA;It will also be easier to deal with more elaborate setups where the&#xA;position of the xpub in the descriptor does matter - for example, with&#xA;miniscript-extended descriptors. With a descriptor template such as&#xA;&#xA;`wsh(or(multi(2, &lt;Alice&gt;, &lt;Bob&gt;, &lt;Carol&gt;), older(1000, &lt;Dylan&gt;))`&#xA;&#xA;The coordinator will be able to store the map between the participant&#xA;labels (Alice, Bob, Carol, Dylan) and their participant ids (and the&#xA;TOKENs). When the data from Alice comes with participant id attached,&#xA;the coordinator will immediately know which TOKEN to use, and which&#xA;place in the descriptor the xpub should be put in.&#xA;&#xA;Of course this is all possible without &#39;participant id&#39; derived from&#xA;token, as long as there&#39;s unique TOKEN per participant - the coordinator&#xA;can always try all the tokens to decrypt the data from participant. But&#xA;implementors will likely invent their own ways to introduce&#xA;&#39;participant id&#39; anyway, as this is more convenient, and it might make&#xA;sense to have this standardized, for interoperability. &#xA;&#xA;В Fri, 12 Feb 2021 09:54:57 -0800&#xA;Hugo Nguyen &lt;hugo at nunchuk.io&gt; wrote:&#xA;&#xA;&gt; On Fri, Feb 12, 2021 at 9:36 AM Dmitry Petukhov &lt;dp at simplexum.com&gt;&#xA;&gt; wrote:&#xA;&gt; &#xA;&gt; &gt; If HUMAN_READABLE_TITLE is the additional secret, the user would&#xA;&gt; &gt; need to enter it on the device in addition to the nonce, wouldn&#39;t&#xA;&gt; &gt; it defeat the advantage in UX that was gained by using (relatively)&#xA;&gt; &gt; short nonce ?&#xA;&gt; &gt;&#xA;&gt; &gt; Is 64 bit nonce not enough ?&#xA;&gt; &gt;&#xA;&gt; &gt;  &#xA;&gt; Good question. If we don&#39;t need the extra entropy, we can fix&#xA;&gt; the HUMAN_READABLE_TITLE string.&#xA;&gt; &#xA;&gt; Something like &#34;No SPOF&#34;. (No Single Point Of Failure).&#xA;&gt; &#xA;&gt; &#xA;&gt; &#xA;&gt; &gt; It seems that to crack this with fixed Pwd and 64 bit nonce, the&#xA;&gt; &gt; attacker will need to be about 10^15 more powerful than 80Mhz MCU:&#xA;&gt; &gt; (2^64)/(0.3*10^15)/3600 = 17 hours. I don&#39;t know if 10^15 is&#xA;&gt; &gt; realistic scale. Average desktop cpu seems to be about 10^3 more&#xA;&gt; &gt; powerful than the mentioned MCU for this task.&#xA;&gt; &gt;&#xA;&gt; &gt; Maybe for the UX it would be better to choose the number of rounds&#xA;&gt; &gt; to use in PBKDF2, instead of using variable Pwd. Number of rounds&#xA;&gt; &gt; will be easier to enter on the device (or just choose it from a set&#xA;&gt; &gt; of pre-defined values). The more money is at stake, the higher&#xA;&gt; &gt; number of rounds could the coordinator choose (taking into account&#xA;&gt; &gt; the characteristics of the participant devices)&#xA;&gt; &gt;  &#xA;&gt; &#xA;&gt; &gt; Or simply allow bigger entropy (more than 6 mnemonic words), if&#xA;&gt; &gt; the coordinator feels that 64 bit of entropy is not enough.  &#xA;&gt; &#xA;&gt; &#xA;&gt; That could work. Allowing variable iteration count is probably better&#xA;&gt; UX-wise.&#xA;&gt; &#xA;&gt; Best,&#xA;&gt; Hugo&#xA;&gt; &#xA;&gt; &#xA;&gt; &gt;&#xA;&gt; &gt; В Fri, 12 Feb 2021 08:55:55 -0800&#xA;&gt; &gt; Hugo Nguyen &lt;hugo at nunchuk.io&gt; wrote:&#xA;&gt; &gt;  &#xA;&gt; &gt; &gt; Thanks everyone who has provided inputs so far!&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; This is the new proposal for the encryption aspect of the scheme,&#xA;&gt; &gt; &gt; based on all the feedback.&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; The key derivation function would be PBKDF2, with PRF = SHA512.&#xA;&gt; &gt; &gt; This should be readily available on today&#39;s hardware already, as&#xA;&gt; &gt; &gt; they are used for BIP39.&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; DK = PBKDF2(PRF, Password, Salt, c, dkLen)&#xA;&gt; &gt; &gt; PRF = SHA512&#xA;&gt; &gt; &gt; Pwd = HUMAN_READABLE_TITLE&#xA;&gt; &gt; &gt; Salt = NONCE&#xA;&gt; &gt; &gt; c = 2048&#xA;&gt; &gt; &gt; dkLen = 256&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; HUMAN_READABLE_TITLE is in ASCII format, minimum length = 8,&#xA;&gt; &gt; &gt; maximum length = 20.&#xA;&gt; &gt; &gt; NONCE is a 64-bit number.&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; Reason for going with SHA512 is due to legacy support on some&#xA;&gt; &gt; &gt; hardware. c=2048 also mimics BIP39. It takes about ~3 seconds to&#xA;&gt; &gt; &gt; derive the encryption key on a 80Mhz MCU. We feel like this is a&#xA;&gt; &gt; &gt; good enough tradeoff for this use case. The assumption here is&#xA;&gt; &gt; &gt; that the secure session is only needed temporarily for a few&#xA;&gt; &gt; &gt; hours, maybe up to one day.&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; The Coordinator and Signers agree and exchange these 2 secrets&#xA;&gt; &gt; &gt; prior to the setup. The NONCE can be converted to either:&#xA;&gt; &gt; &gt; (a) a 6-word phrase using BIP39 wordlist&#xA;&gt; &gt; &gt; (b) a 20-digit decimal number&#xA;&gt; &gt; &gt; (c) a QR code&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; Depending on the vendor. This flexibility in the data format&#xA;&gt; &gt; &gt; allows each vendor to customize the UX based on their respective&#xA;&gt; &gt; &gt; device capabilities.&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; Best,&#xA;&gt; &gt; &gt; Hugo&#xA;&gt; &gt; &gt;&#xA;&gt; &gt; &gt; On Thu, Feb 11, 2021 at 8:25 AM Dmitry Petukhov via bitcoin-dev &lt;&#xA;&gt; &gt; &gt; bitcoin-dev at lists.linuxfoundation.org&gt; wrote:&#xA;&gt; &gt; &gt;  &#xA;&gt; &gt; &gt; &gt; В Thu, 11 Feb 2021 05:45:33 -0800&#xA;&gt; &gt; &gt; &gt; Hugo Nguyen via bitcoin-dev&#xA;&gt; &gt; &gt; &gt; &lt;bitcoin-dev at lists.linuxfoundation.org&gt; wrote:&#xA;&gt; &gt; &gt; &gt;  &#xA;&gt; &gt; &gt; &gt; &gt; &gt; &gt; ENCRYPTION_KEY = SHA256(SHA256(TOKEN))  &#xA;&gt; &gt; &gt; &gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; &gt; &gt; This scheme might be vulnerable to rainbow table attack.&#xA;&gt; &gt; &gt; &gt; &gt; &gt;  &#xA;&gt; &gt; &gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; &gt; Thank you for pointing this out! Incidentally, Dmitry Petukhov&#xA;&gt; &gt; &gt; &gt; &gt; also told me the same privately.  &#xA;&gt; &gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; My thought was that if TOKEN has the characteristics of a&#xA;&gt; &gt; &gt; &gt; password (short ASCII string), then it would be better to use&#xA;&gt; &gt; &gt; &gt; key derivation function designed for passwords, like PBKDF2.&#xA;&gt; &gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; The counter-argument to this is that this adds another code&#xA;&gt; &gt; &gt; &gt; dependency for vendors, if the device firmware does not already&#xA;&gt; &gt; &gt; &gt; have the required key derivation function.&#xA;&gt; &gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; Maybe this could be solved by going into opposite direction -&#xA;&gt; &gt; &gt; &gt; make the &#34;token&#34; even longer, use the mnemoic.&#xA;&gt; &gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; The issue is that entering long data of the shared key into the&#xA;&gt; &gt; &gt; &gt; device manually is difficult UX-wise.&#xA;&gt; &gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; Hww vendors that allow to enter custom keys into their device&#xA;&gt; &gt; &gt; &gt; already have to face this issue, and those who allow to enter&#xA;&gt; &gt; &gt; &gt; custom keys via mnemonic probably tackled this somehow.&#xA;&gt; &gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; Maybe the shared key for multisig setup can be entered in the&#xA;&gt; &gt; &gt; &gt; same way ? (with maybe additional visual check via some&#xA;&gt; &gt; &gt; &gt; fingerprint).&#xA;&gt; &gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; Although we would then have another issue of potential confusion&#xA;&gt; &gt; &gt; &gt; between two procedures (entering the main key and entering the&#xA;&gt; &gt; &gt; &gt; shared key for multisig setup), and the measures has to be&#xA;&gt; &gt; &gt; &gt; taken to prevent such confusion.&#xA;&gt; &gt; &gt; &gt;&#xA;&gt; &gt; &gt; &gt; The approaches can be combined - specify a key derivation&#xA;&gt; &gt; &gt; &gt; function suitable for passwords; via secure channel, share a&#xA;&gt; &gt; &gt; &gt; password and/or the derived key. If hww supports derivation&#xA;&gt; &gt; &gt; &gt; function, it can derive the key from password. If hww supports&#xA;&gt; &gt; &gt; &gt; only keys, the key can be entered raw or via mnemonic.&#xA;&gt; &gt; &gt; &gt; _______________________________________________&#xA;&gt; &gt; &gt; &gt; bitcoin-dev mailing list&#xA;&gt; &gt; &gt; &gt; bitcoin-dev at lists.linuxfoundation.org&#xA;&gt; &gt; &gt; &gt; https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev&#xA;&gt; &gt; &gt; &gt;  &#xA;&gt; &gt;&#xA;&gt; &gt;</html></oembed>