October 3rd, 2011, 10:03 PM

MultiKey Encryption of Same File  Decryption Query
Hi,
A simple question I hope: is there is a known probability or a way to calculate it, for the following scenario:
* A file is encrypted 3 times with 3 keys
* The result of each separate encryption is saved to a separate file
* The source is encrypted only once per file (the encryption is not applied multiple times to the output of the last encryption)
If the start of the encrypted stream was a constant unrelated to the rest of the file, what is the chance of a 4th random key decrypting e.g. the first byte to match the constant, or the first 4 bytes to match, even if the rest of the data is junk due to a bad key?
I'm thinking particularly AES and RSA with key lengths equal to or in excess of 256 bit and 4096 bit, respectively. Assume AES to be in CBC mode.
Best regards,
AstroTux.
October 4th, 2011, 08:45 PM

You can ignore all the details about what algorithm, how many times, key sizes etc. A good encryption algorithm produces output that is (essentially) random. So what's the chance of a random N bytes being your magic constant?
sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}>(\&Meh);
October 5th, 2011, 06:10 AM

Whilst you raise an interedting point, you essentially asked the same question I did.
So... basically there is only one key for one ciphertext that results in correct decryption, and there is no room for a random but incorrect key to result in partial but correct decryption of the first four bytes (for example)?
Best regards,
AstroTux.
Last edited by AstroTux; October 5th, 2011 at 06:12 AM.
October 5th, 2011, 07:08 AM

Sorry, I meant for that question to give you the answer. Try thinking on these lines:
N bits have 2**N possible values.
An algorithm with Mbit key means there are 2**M possible decryptions of a text.
(Note the pigeonhole principle when N < M)
Assuming that those decryptions are randomly distributed, how many of those decryptions will start with a particular Nbit value?
sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}>(\&Meh);
October 5th, 2011, 09:46 AM

D'oh!!! I see. Thanks!
Best regards,
AstroTux.