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 <clientRecoveryPubKey> <serverRecoveryPubKey> 2 CHECKMULTISIGVERIFY
ELSE
     2 <userWalletPubKey> <serverWalletPubKey> 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