2
$\begingroup$

i am having problems understanding how CBC works! I know that it is a chain and the IV is XORed with the PT but then what? I mean we encrypt it with key k and the result is the CT which we use for the next chain-XOR but my question is HOW the encryption works? For example in Stream ciphers i just had to XOR the K with the M (or C) to get my result, but on block ciphers i am completely lost...

$\endgroup$
1
  • $\begingroup$ Have a look at the drawings here then tell us what remains unclear $\endgroup$
    – fgrieu
    Sep 11, 2012 at 10:02

1 Answer 1

5
$\begingroup$

CBC is a block cipher mode of operation, not a cipher. It can work basically with any block cipher - the choice of the block cipher itself is independent (to a large extent) from the choice of the mode of operation.

Examples of well known block ciphers include AES, DES, TripleDES, Serpent, Blowfish etc.

The title of your question, however, asks about decrypting AES using CBC mode operation. In which case you should be using AES, $P_t = \operatorname{AES-128-DEC}_k(C_t) \operatorname{XOR} C_{t-1}$. AES decryption is available in many crypto libraries (for example libtomcrypt, Crypto++, openssl, Java Cryptography Extensions, Python Cryptography Toolkit), and you can even use online AES "calculators" such as this one.

$\endgroup$
11
  • $\begingroup$ yes but lets say that the key is 10101010 and the IV 01010101 how do i encrypt the 11110000 i need to know the procedure AFTER the XOR operation. $\endgroup$
    – angelo
    Sep 11, 2012 at 9:12
  • $\begingroup$ CBC only says basically that C_t = ENC_k(C_{t-1} XOR P_t). ENC_k here is the encryption operation of the block cipher (whichever you choose, for example AES-128) with the key k. That's all. The details are a matter of the choice of the specific block cipher. $\endgroup$
    – Harel
    Sep 11, 2012 at 9:15
  • $\begingroup$ ok i get what ou are syaing but just to make it more clear, i am following a cryptography course in coursera.org where given the k and the IV i have to decrypt a CT, so i am doing the flowing: (IV xor c_1) xor k (for the first block) and (m_1 xor c_2) xor k (for the second one and so on) but that does not return any reasonable result what am i doin wrong? $\endgroup$
    – angelo
    Sep 11, 2012 at 9:20
  • $\begingroup$ If I understand you correctly, what you're doing is correct only if your "block cipher" is simple XOR, which in all likelihood it is not (unless the guys in Coursera gave you a somewhat esoteric assignment). More likely you should be using some "real" block cipher here. Furthermore, a ciphertext will usually not look "reasonable" no matter what. You know you have it right when you can decrypt it back to plaintext. $\endgroup$
    – Harel
    Sep 11, 2012 at 9:22
  • $\begingroup$ ok then is there any specific method to follow other than XORing? How would you normally decrypt/encrypt with CBC method given a K and a IV?(just give me a link/source if you will/have so i dont waste your time on newbie questions :D) $\endgroup$
    – angelo
    Sep 11, 2012 at 9:29

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.