Bitcoin Forum

Bitcoin => Electrum => Topic started by: AlzoxX76 on August 18, 2018, 07:05:22 PM



Title: Electrum encryption AES256-CBC
Post by: AlzoxX76 on August 18, 2018, 07:05:22 PM
Hi,


Why use CBC mode for encrypt wallet ? The random access was not necessary right ? So why not use PCBC mode ?


Title: Re: Electrum encryption AES256-CBC
Post by: bob123 on August 19, 2018, 11:06:21 AM
Why use CBC mode for encrypt wallet ?

Why should one not use CBC to encrypt the private keys ?
Block cipher should be favored in a use case of a wallet. And since CBC doesn't have any important downside, why not.



The random access was not necessary right ?

With 'random access' you probably mean the possibility to parallel the encryption/decryption?
No, this is not necessary since you are never en-/decrypting a lot of data.



So why not use PCBC mode ?

Why should PCBC be used ?

There is a  problem with PCBC.
Swapping 2 ciphertext blocks will result in the incorrect decryption of the 2 corresponding plaintext blocks.
But due to the nature of plaintext XOR ciphertext the error cancels in PCBC mode.
So if the integrity checker only looks at the last few blocks it could be fooled to accept a partially corrupted message.

That's one of the reasons why Kerberos switched from PCBC to CBC in version 5.