#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2008
    Posts
    601
    Rep Power
    43

    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. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2007
    Posts
    765
    Rep Power
    929
    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);
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2008
    Posts
    601
    Rep Power
    43
    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.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2007
    Posts
    765
    Rep Power
    929
    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?
    sub{*{$::{$_}}{CODE}==$_[0]&& print for(%:: )}->(\&Meh);
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2008
    Posts
    601
    Rep Power
    43
    D'oh!!! I see. Thanks!

    Best regards,
    AstroTux.

IMN logo majestic logo threadwatch logo seochat tools logo