Forums: » Register « |  Free Tools |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

New Free Tools on Dev Shed!

#1
October 3rd, 2011, 10:03 PM
 AstroTux
Contributing User

Join Date: Feb 2008
Posts: 601
Time spent in forums: 5 Days 1 h 18 m 32 sec
Reputation Power: 42
Crypto Protocol Question - Multi-Key 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.

#2
October 4th, 2011, 08:45 PM
 OmegaZero
Contributing User

Join Date: May 2007
Posts: 756
Time spent in forums: 3 Weeks 6 Days 8 h 9 m 41 sec
Reputation Power: 928
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);

#3
October 5th, 2011, 06:10 AM
 AstroTux
Contributing User

Join Date: Feb 2008
Posts: 601
Time spent in forums: 5 Days 1 h 18 m 32 sec
Reputation Power: 42
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.

#4
October 5th, 2011, 07:08 AM
 OmegaZero
Contributing User

Join Date: May 2007
Posts: 756
Time spent in forums: 3 Weeks 6 Days 8 h 9 m 41 sec
Reputation Power: 928
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 M-bit 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 N-bit value?

#5
October 5th, 2011, 09:46 AM
 AstroTux
Contributing User

Join Date: Feb 2008
Posts: 601
Time spent in forums: 5 Days 1 h 18 m 32 sec
Reputation Power: 42
D'oh!!! I see. Thanks!

Best regards,
AstroTux.

 Viewing: Dev Shed Forums > System Administration > Security and Cryptography > Crypto Protocol Question - Multi-Key Encryption of Same File - Decryption Query