1
$\begingroup$

As title, is this a safe deterministic encryption to use the second block of plaintext as IV, and encrypt with CBC mode?

I am sure that the second block used as IV is different than the first block for each record, so there won't be an "all zeros" problem.

$\endgroup$
  • $\begingroup$ How would you decrypt the ciphertext without exposing the plaintext block used as an IV? $\endgroup$ – knbk Apr 25 '17 at 9:36
  • $\begingroup$ I use the second block as IV, so the decrypt function will be hard-coded that the second block will be used as IV to decrypt. $\endgroup$ – Bobo Liao Apr 25 '17 at 9:42
  • $\begingroup$ @BoboLiao And how do you want to decrypt the second block? $\endgroup$ – CodesInChaos Apr 25 '17 at 9:43
  • $\begingroup$ @BoboLiao Not if you don't have the IV. $\endgroup$ – Elias Apr 25 '17 at 9:59
  • 1
    $\begingroup$ the plaintext of 2nd block = Decrypt(key, ciphertext of 2nd block) Xor ciphertext of 1st block?? Or is my understanding about the CBC mode wrong? $\endgroup$ – Bobo Liao Apr 25 '17 at 10:02
1
$\begingroup$

No, you should not do that. Any time you encrypt a message with CBC you should use a new, random IV and send it together with the ciphertext. Don't encrypt the IV after usage.

The IV for CBC mode has to be unpredictable. That means you can't reuse an IV and you should not take any already used value from elsewhere. That was the problem of TLS with the BEAST attack, you maybe have heard of it. As soon as an attacker can make any statements about the IV there could be a serious security problem with your scheme.

IVs are also used to make the encryption more random - with your scheme, your IV only depends on your message, so the ciphertext is always the same when the message is the same. We mostly don't want that because it would show an attacker that we are sending the same message again.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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