Author

Topic: Bitcoin Core - Loss of privacy when encrypting your wallet for the first time? (Read 204 times)

staff
Activity: 3458
Merit: 6793
Just writing some code
So I was thinking. I just encrypted my wallet for the first time and the file size cut about in half. I am assuming this is due to some sort of compression in the encryption stage, but it causes a possible loss of privacy by doing this.

Say I have an unencrypted wallet of 50mb and it turns to 25mb when encrypted. What happens to the other 25mb of unencrypted wallet file that's left on the hard drive? Couldn't a data recovery specialist recover these keys unencrypted?

Sorry if I am being ignorant and thanks for any input.

Edit: unless the encryption is done before the compression.. Duh lol
The other 25mb of data is not private key data.

The reason you see a size reduction is actually not because of compression. When your wallet is unencrypted, the private key format is much larger for backwards compatibility reasons. In the original Bitcoin client, private keys were stored as OpenSSL serialized them. This serialization included things like curve parameters and the uncompressed public key for that private key. This information is redundant and completely unnecessary, but has to be serialized for backwards compatibility reasons. When you encrypt the wallet, the private key that gets encrypted no longer contains all of that unnecessary information, it just contains the private key itself. This is much smaller even when encrypted , and since it happens to every single private key, a lot of space is saved.
newbie
Activity: 3
Merit: 2
legendary
Activity: 1624
Merit: 2481
But what if you've imported a bunch of keys prior to encrypting? Then each individual key is contained unencrypted in the wallet.dat file, no?
Does importing keys into an already encrypted wallet prevent the unencrypted keys from betting written to the drive?

No, imported keys are also encrypted.
There is no unencrypted (sensitive) information anywhere on your harddrive left after encrypting your wallet file.

Just make sure to backup your wallet file after encrypting / importing keys.

Sensitive information is just accessible unencrypted when your wallet is unlocked (master key stored in RAM).
newbie
Activity: 3
Merit: 2
I don't know about 25MB of leftover file, but AFAIK after you encrypt your Bitcoin Core wallet, you will use different private key/master private key.
If you encrypt your wallet before you made any transaction or receive coins from address which created before the wallet is encrypted, you have nothing to worry.

Right. And 25mb is a random example.

But what if you've imported a bunch of keys prior to encrypting? Then each individual key is contained unencrypted in the wallet.dat file, no? Does importing keys into an already encrypted wallet prevent the unencrypted keys from betting written to the drive?
newbie
Activity: 3
Merit: 2
So I was thinking. I just encrypted my wallet for the first time and the file size cut about in half. I am assuming this is due to some sort of compression in the encryption stage, but it causes a possible loss of privacy by doing this.

Say I have an unencrypted wallet of 50mb and it turns to 25mb when encrypted. What happens to the other 25mb of unencrypted wallet file that's left on the hard drive? Couldn't a data recovery specialist recover these keys unencrypted?

Sorry if I am being ignorant and thanks for any input.

Edit: unless the encryption is done before the compression.. Duh lol
Jump to: