Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id CB332C01 for ; Wed, 9 Aug 2017 20:14:19 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pg0-f54.google.com (mail-pg0-f54.google.com [74.125.83.54]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id BB5014FC for ; Wed, 9 Aug 2017 20:14:19 +0000 (UTC) Received: by mail-pg0-f54.google.com with SMTP id v77so32192680pgb.3 for ; Wed, 09 Aug 2017 13:14:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=g0fj4Mk8FEdTD/Li0xwDxME/aiIz+YXidNCsr4cWmWQ=; b=X63CbLqzc8wBJ5wIrto5pBPMfE9W2cnDex8mJHiib/qwlxeyH8CoPWnvJ9+SdDuhra nVIJr2m+he6RKn3J9Nn6GMo/AUGZmgGIFnFleTUabxgyrKwLPgp0FmlnTdIlmPnEOnu1 DLIhn3KGR0uSaNgPTXb9Hn0t3lvVsfH/iqRd4dgPZedrpaMIkYGyO/XSbUHQJWBMTYVt Wo9LqJdey3TdErUp3kpQlZAekLts9NCHR8CkcM2jprqSut1y3UxElvk76E1Gx2m0GCXD GlCA+JKihPT3m/klXlUOSvZiHjnQFU6owul0uBflu6eszFMNY5OUilAcnPoH7ZQVPJzQ /zNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=g0fj4Mk8FEdTD/Li0xwDxME/aiIz+YXidNCsr4cWmWQ=; b=K1VPh5jrb/WxNJhW2u+CH42XsbmUtbSKbj2MMRBaNwjmz1Mkht2yJUm6vGgb0XwZRR +HYpyRXHkxAn6X9w/tHaIKnZ+33VeaOPbD4wVyYyVmElYqi+YHs35J9Q/oabeNmtaFHk Wqo8F7PVjquMk0GdxJOOgnnuUEmEP9yJz4bBOanl9bQCJc0F4ZVawFu1HyN4FGsCgK4C 7L36kSOUQ0MFaSMr0RHVDaRz5rRIiT0/MifErvJEMEWz+F4sioiVcyT8f+T8+WolmUEQ KYF+tpdzDvdVBBmFLo0JLdyiY3PoSMGtwHIzFo0S3W1HEfDJE3MtKfQ0yf6UUF5slLDI XVuA== X-Gm-Message-State: AHYfb5iKLGBOBqrHph/WT5XWkvJgfJgnB61lkAjptPoIvZPqyYMJDNkj 77GnLh0pNi1Y5vEs+7KxB7tDl3dQuA== X-Received: by 10.98.70.86 with SMTP id t83mr9443270pfa.219.1502309659157; Wed, 09 Aug 2017 13:14:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.166.168 with HTTP; Wed, 9 Aug 2017 13:14:18 -0700 (PDT) In-Reply-To: References: From: Nick ODell Date: Wed, 9 Aug 2017 14:14:18 -0600 Message-ID: To: Colin Lacina , Bitcoin Protocol Discussion Content-Type: multipart/alternative; boundary="94eb2c0b82a493ac43055657b94e" X-Mailman-Approved-At: Wed, 09 Aug 2017 20:15:31 +0000 Subject: Re: [bitcoin-dev] Structure for Trustless Hybrid Bitcoin Wallets Using P2SH for Recovery Options 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: Wed, 09 Aug 2017 20:14:19 -0000 --94eb2c0b82a493ac43055657b94e Content-Type: text/plain; charset="UTF-8" Colin, 1) This is a good start for a BIP, but it's missing details. For example, the nonce is encrypted by the server. What key is it encrypted with? Clarifying ambiguities like this can sometimes reveal weaknesses that you wouldn't otherwise think of. 2) What kind of recovery questions are asked? If it's something like "What was the name of your first pet?" then what prevents the server from stealing the wallet by trying a dictionary of the most common pet names? Is there a mitigation to this, besides picking cryptographically secure identifiers for my pets? --Nick On Wed, Aug 9, 2017 at 12:49 PM, Colin Lacina via bitcoin-dev < bitcoin-dev@lists.linuxfoundation.org> wrote: > I believe I have come up with a structure that allows for trustless use of > hybrid wallets that would allow for someone to use a hybrid wallet without > having to trust it while still allowing for emergency recovery of funds in > the case of a lost wallet. It would run off of this TX script: > > IF > 1 2 CHECKMULTISIGVERIFY > ELSE > 2 2 CHECKMULTISIG > ENDIF > > A typical transaction using this would involve a user signing a TX with > their userWalletPrivKey, authenticating with the server, possibly with 2FA > using a phone or something like Authy or Google Authenticator. After > authentication, the server signs with their serverWalletPrivKey. > > In case the server goes rogue and starts refusing to sign, the user can > use their userRecoveryPrivKey to send the funds anywhere they choose. > Because if this, the userRecoveryPrivKey is best suited to cold wallet > storage. > > In the more likely event that the user forgets their password and/or > looses access to their userWalletPrivKey as well as loses their recovery > key, they rely on the serverRecoveryPrivKey. > > When the user first sets up their wallet, they answer some basic identity > information, set up a recovery password, and/or set up recovery questions > and answers. This information is explicitly NOT sent to serve with the > exception of recovery questions (although the answers remain with the user, > never seeing the server). What is sent to the server is it's 256 bit hash > used to identify the recovery wallet. The server then creates a 1025 bit > nonce, encrypts it, stores it, and transmits it to the user's client. > > Meanwhile, the user's wallet client generates the serverRecoveryPrivKey. > > Once the client has both the serverRecoveryPrivKey, and the nonce, it uses > SHA512 on the combination of the identity questions and answers, the > recovery password (if used), the recovery questions and answers, and the > nonce. It uses the resulting hash to encrypt the serverRecoveryPrivKey. > > Finally, the already encrypted key is encrypted again for transmission to > the server. The server decrypts it, then rencrypts it for long term storage. > > When the user needs to resort to using this option, they 256 bit hash > their information to build their recovery identifier. The server may, > optionally, request e-mail and or SMS confirmation that user is actually > attempting the recovery. > > Next, the server decrypts the saved nonce, as well as the first layer of > encryption on the serverRecoveryPrivKey, then encrypts both for > transmission to the user's client. Then the client removes the transmission > encryption, calculates the 512 bit hash that was used to originally encrypt > the serverRecoveryPrivKey by using the provided information and the nonce. > > After all of that the user can decrypt the airbitzServerRecoveryPrivKey > and use it to send a transaction anywhere they choose. > > I was thinking this may make a good informational BIP but would like > feedback. > > _______________________________________________ > bitcoin-dev mailing list > bitcoin-dev@lists.linuxfoundation.org > https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev > > --94eb2c0b82a493ac43055657b94e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Colin,

1) This is a good sta= rt for a BIP, but it's missing details. For example, the nonce is encry= pted by the server. What key is it encrypted with? Clarifying ambiguities l= ike this can sometimes reveal weaknesses that you wouldn't otherwise th= ink of.

2) What kind of recovery questions are ask= ed? If it's something like "What was the name of your first pet?&q= uot; then what prevents the server from stealing the wallet by trying a dic= tionary of the most common pet names? Is there a mitigation to this, beside= s picking cryptographically secure identifiers for my pets?

<= /div>
--Nick

On Wed, Aug 9, 2017 at 12:49 PM, Colin Lacina via bitcoin-dev <bitcoin-dev@lists.linuxfoundation.org> wr= ote:
I believe I have c= ome up with a structure that allows for trustless use of hybrid wallets tha= t would allow for someone to use a hybrid wallet without having to trust it= while still allowing for emergency recovery of funds in the case of a lost= wallet. It would run off of this TX script:

IF
=C2=A0 =C2=A0 =C2=A01 <clientRe= coveryPubKey>=C2=A0<serve= rRecoveryPubKey> 2 CHECKMULTISIGVERIFY
ELSE
=C2=A0 =C2=A0 =C2=A02 <userWalletPubK= ey> <serverWalletPubKey> 2 CHECKMULTISIG
ENDIF

A typical transaction using this= would involve a user signing a TX with their userWalletPrivKey, authentica= ting with the server, possibly with 2FA using a phone or something like Aut= hy or Google Authenticator. After authentication, the server signs with the= ir serverWalletPrivKey.

In case the server goes rogue and starts refusing to sign,= the user can use their userRecoveryPrivKey to send the funds anywhere they= choose. Because if this, the userRecoveryPrivKey is best suited to cold wa= llet storage.

In the more likely event that the user forgets their password=C2=A0<= /span>and/or looses access to their = userWalletPrivKey=C2=A0as wel= l as loses their recovery key, they rely on the serverRecoveryPrivKey.

When the us= er first sets up their wallet, they answer some basic identity information,= set up a recovery password, and/or set up recovery questions and answers. = This information is explicitly NOT sent to serve with the exception of reco= very questions (although the answers remain with the user, never seeing the= server). What is sent to the server is it's 256 bit hash used to ident= ify the recovery wallet. The server then creates a 1025 bit nonce, encrypts= it, stores it, and transmits it to the user's client.

Meanwhile, the user'= ;s wallet client generates the serverRecoveryPrivKey.

Once the client has both t= he serverRecoveryPrivKey, and the nonce, it uses SHA512 on the combination = of the identity questions and answers, the recovery password (if used), the= recovery questions and answers, and the nonce. It uses the resulting hash = to encrypt the serverRecoveryPrivKey.

Finally, the already encrypted key is encryp= ted again for transmission to the server. The server decrypts it, then renc= rypts it for long term storage.

When the user needs to resort to using this opt= ion, they 256 bit hash their information to build their recovery identifier= . The server may, optionally, request e-mail and or SMS confirmation that u= ser is actually attempting the recovery.

Next, the server decrypts the saved nonce= , as well as the first layer of encryption on the serverRecoveryPrivKey, th= en encrypts both for transmission to the user's client. Then the client= removes the transmission encryption, calculates the 512 bit hash that was = used to originally encrypt the serverRecoveryPrivKey by using the provided = information and the nonce.

After all of that the user can decrypt the airbitzServe= rRecoveryPrivKey and use it to send a transaction anywhere they choose.

I was thin= king this may make a good informational BIP but would like feedback.=

_______________________________________________
bitcoin-dev mailing list
bitcoin-dev@lists.= linuxfoundation.org
https://lists.linuxfoundation.org= /mailman/listinfo/bitcoin-dev


--94eb2c0b82a493ac43055657b94e--