<p>It depends what your goal is. Normally when sites have a user's key encrypted as to be unreadable to the site, it's to have a system where users don't have to trust the site not to steal the key. In that case, then no, because the whole point of a technique like that is to have it so the service provider doesn't have control of the user's keys at all. Any workaround to that would defeat the purpose.</p>
<p>If your goal is to protect the keys from outside hackers, then the site can (and most do) employ cold storage or hardware security modules (basically a fancy hardware wallet) that store the keys. In this case, the site owners still have full control of the keys, and the users have to trust the site owners to be honest. However, the scope of a potential hack is limited, as the keys are stored either on dedicated hardware, or if in cold storage, large withdrawals are performed manually by site staff after review.</p>

CC BY-SA 4.0
2021-01-29T18:21:24.703Z
@_ieatpizza My goal is to protect the keys from outside hackers. I'm aware of the option of using  "hardware security" to protect the PK but I fail to understand why a malicious user can't seize control of the server and send (unlimited) withdrawal requests to the hardware module (while pretending to be legitimate requests) and siphon all funds from the wallet without every comprising the actual PK. Does the hardware module somehow "validate" a request before "approving" it to limit scope of damage?
S.O.S
CC BY-SA 4.0
2021-01-29T18:23:56.623Z
Additionally, in the first example (encrypting the PK so users won't have to trust the site) users would still need to trust the site that they are in fact encrypting the PK. So there would still be a big element of trust between the site and user.
S.O.S
CC BY-SA 4.0
2021-01-29T21:09:27.720Z
@S.O.S For your first comment, refer to your other question: https://bitcoin.stackexchange.com/questions/101986 For your second comment: No, not necessarily, the sites that are encrypting the user's private key are generally doing the encryption on the user's browser in Javascript and sending only the encrypted text back to the service. Technically savvy users can review that Javascript and make sure that it's really doing what it claims to be doing.
ieatpizza
CC BY-SA 4.0
2021-01-29T07:35:00.977Z
2021-01-29T07:35:00.977Z
ieatpizza
<p><a href="https://bitcoin.stackexchange.com/a/76482/78451">A powerful security technique</a> to prevent theft of Bitcoins from a user's online wallet is to encrypt the user's private key with his password without ever stroring the PK directly in the database. Even if a hacker compromises the server they still won't be able to access the user's wallet without his password.</p>
<p>In case a website needs to have custodial control over a user's funds (for example, <a href="https://bitcoin.stackexchange.com/a/76482/78451">an exchange</a> or escrow service in a marketplace) this solution isn't viable as the exchange needs to have complete control over the user's funds to move funds from one party to another (say from the buyer to the merchant or to a trader in an exchange). So it cannot be expected that the exchange must ask one party &quot;permission&quot; to transfer funds to the other party. Of course, the exchange or marketplace can encrypt the PK but since it would also need to host the decryption key somewhere on the server there's little benefit in encrypting the PK in the first place.</p>
<p>Is there a variation of this technique that might work even in a marketplace or exchange environment which requires that the owner (of the marketplace or exchange) maintain full control over a user's deposit?</p>
<p>Thanks</p>

<bitcoin-core><security><exchanges><private-key>
Can an exchange or marketplace benefit from private key encryption?
S.O.S
# Can an exchange or marketplace benefit from private key encryption?

(Asked by: username_0 on 2021-01-29)

[A powerful security technique](https://bitcoin.stackexchange.com/a/76482/78451) to prevent theft of Bitcoins from a user's online wallet is to encrypt the user's private key with his password without ever stroring the PK directly in the database. Even if a hacker compromises the server they still won't be able to access the user's wallet without his password.

In case a website needs to have custodial control over a user's funds (for example, [an exchange](https://bitcoin.stackexchange.com/a/76482/78451) or escrow service in a marketplace) this solution isn't viable as the exchange needs to have complete control over the user's funds to move funds from one party to another (say from the buyer to the merchant or to a trader in an exchange). So it cannot be expected that the exchange must ask one party "permission" to transfer funds to the other party. Of course, the exchange or marketplace can encrypt the PK but since it would also need to host the decryption key somewhere on the server there's little benefit in encrypting the PK in the first place.

Is there a variation of this technique that might work even in a marketplace or exchange environment which requires that the owner (of the marketplace or exchange) maintain full control over a user's deposit?

Thanks

**Tags:** bitcoin-core, security, exchanges, private-key


---

## 1 answers

### Answer by username_1 on 2021-01-29. Score: 1

It depends what your goal is. Normally when sites have a user's key encrypted as to be unreadable to the site, it's to have a system where users don't have to trust the site not to steal the key. In that case, then no, because the whole point of a technique like that is to have it so the service provider doesn't have control of the user's keys at all. Any workaround to that would defeat the purpose.

If your goal is to protect the keys from outside hackers, then the site can (and most do) employ cold storage or hardware security modules (basically a fancy hardware wallet) that store the keys. In this case, the site owners still have full control of the keys, and the users have to trust the site owners to be honest. However, the scope of a potential hack is limited, as the keys are stored either on dedicated hardware, or if in cold storage, large withdrawals are performed manually by site staff after review.

> **Comments:**
> **username_0**: @_ieatpizza My goal is to protect the keys from outside hackers. I'm aware of the option of using  "hardware security" to protect the PK but I fail to understand why a malicious user can't seize control of the server and send (unlimited) withdrawal requests to the hardware module (while pretending to be legitimate requests) and siphon all funds from the wallet without every comprising the actual PK. Does the hardware module somehow "validate" a request before "approving" it to limit scope of damage?  
> **username_0**: Additionally, in the first example (encrypting the PK so users won't have to trust the site) users would still need to trust the site that they are in fact encrypting the PK. So there would still be a big element of trust between the site and user.  
> **username_1**: @username_0 For your first comment, refer to your other question: https://bitcoin.stackexchange.com/questions/101986 For your second comment: No, not necessarily, the sites that are encrypting the user's private key are generally doing the encryption on the user's browser in Javascript and sending only the encrypted text back to the service. Technically savvy users can review that Javascript and make sure that it's really doing what it claims to be doing.  

---

