0
$\begingroup$

i want to encrypt transparently using Rijndael. So this is, what I thought of and I would like to have an opinion from "Experts" whether this will harm encryption strenght.

  • I am using chunks of 1MB and give them a GUID as filename.
    edit: The 1MB chunks are just out of performance reasons. Imagine a file of 500MB to decrypt, deflate change some bytes, compress again and encrypt again. Is it really that bad a security vulnerability?
  • These chunks are then first compresses using DEFLATE to minimize attacks based on known Content.
  • These chunks are then encrypted using Rijndael and a given Cipherkey. The IV will be created as an XOR of my Filename (the guid) and the Key behind the scenes.
    edit: The IV is never stored, but always created anew from the GUID and the Key. As far as I understand, this is the IV only for the first cipher block in CBC. (GUID XOR Key) XOR Plaintext -> ciphering -> new IV for next block.
    Is it possible to deduce the IV from ciphered data, without knowing the key? If so, this IS a bad idea. Otherwise I dont see the the disadvantage.
    Would this be viewed more secure? Cipher the GUID with the key and an IV of Zeros and use this as the IV for my ciphering.
  • All chunks are then collected in an XML File, which is saved the same way but named as the original file name.
  • Will the creation of the IV harm the security in any way?
    Am I doing something else terribly wrong?
    Are there are other obvious weak spots that I am missing?

    Thanks a lot!
    Andreas

    $\endgroup$

    1 Answer 1

    3
    $\begingroup$

    I am using chunks of 1MB and give them a GUID as filename

    That is fine although unnecessary, the entire input file can be encrypted.

    These chunks are then first compresses using DEFLATE to minimize attacks based on known Content

    VERY BAD idea, since you are breaking the input file into pieces, you are now exposing the entropy of specific file sections to an attacker. Either compress the file before you break it up, or do not break it up at all (or do not compress it)

    These chunks are then encrypted using Rijndael and a given Cipherkey. The IV will be created as an XOR of my Filename and the Key.

    VERY BAD idea, now the attacker has the key. Use a random IV for CBC mode or a sequential IV for CTR mode. You have not specified your mode of operation.

    All chunks are then collected in an XML File, which is saved the same way but named as the original file name

    I would keep the actual file name in the XML file in an encrypted format so you do not expose the potential file type or content. You can also keep hashes of the encrypted data, and integrity information in the XML file.

    Are there are other obvious weak spots that I am missing

    Probably; your proposed IV generation scheme means you do not know enough about cryptography to be developing an encryption program, do more research and get more education on the subject before continuing. Cryptography Engineering would be a good starting point.

    $\endgroup$
    7
    • $\begingroup$ Thank you for your answer. Please see the edit according to chunking. The Filename will be the GUID. How do i tell the Key, by XORing it with a GUID and using the result as IV? As far as I know, the IV is just a starting point for CBC. If it is always the same, the first encrypted bytes will always be the same. But that is also true, with a stored random IV, which could be read. I am still encrypting the chunk with the keywith CBC, since the used lib does not support CTR. I knew, that XORing reduces the strength of encryption. I am asking here, to find out HOW BAD my idea was. $\endgroup$
      – Andreas
      Apr 8, 2014 at 15:19
    • $\begingroup$ And Richie answered: Catastrophic. Anyone who knows the name of the file can compare it with the IV to learn the key, since fileName$\oplus$IV$=$Key $\endgroup$ Apr 8, 2014 at 15:36
    • $\begingroup$ Yes, I am new to cryptography, but I know, that XOR is a very bad idea, when you want to cipher something (except for one-time-pads, which are the only 'unbreakable' cipher). I did not know, that the IV is usually shipped. BUT this also means, that my assumtion was right, and it is not critical to the actual encryption, which means, that I could 'create' an IV from fixed data, everytime I need it. $\endgroup$
      – Andreas
      Apr 8, 2014 at 18:44
    • $\begingroup$ XOR is fine if done correctly. With CBC, the IV is ok to be known, but should be unpredictable, and creating it from fixed data makes it predictable. Using the key as that fixed data may be ok if you are encrypting a counter to gen the IV. And by encrypting I mean using the block cipher, not xor $\endgroup$ Apr 8, 2014 at 19:02
    • $\begingroup$ so.... if i encrypt the guid with the key using rijndael again, might that be unpredictable enough to be used as IV? $\endgroup$
      – Andreas
      Apr 8, 2014 at 19:06

    Your Answer

    By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

    Not the answer you're looking for? Browse other questions tagged or ask your own question.