-1
$\begingroup$

As I understand DES, It encrypt 64-bit plaintext block with 56-bit key (ECB).

So if 3DES is applying DES three time then why it use Decryption $(D)$ in the Phase 2 in place of Encryption $(E)$ ? And how it is possible to decrypt a ciphertext $( [K_2,E[K_1,P]] )$ which was encrypted by different key $(K_1)$?

Phase 1: $E[K_1,P]$

Phase 2: $D[K_2,E[K_1,P]]$

Phase 3: $E[K_3,D[K_2,E[K_1,P]]].$

3DES: $C=E[K_3,D[K_2,E[K_1,P]]].$

So can anyone explain how 3DES works?

For your information it's not exactly duplicate of the question because,

  1. I want to know How 3DES works? Not only 2nd phase work.
  2. The answer of mentioned question doesn't satisfy my question as that answer said Encryption and Decryption is same method.
$\endgroup$
2

1 Answer 1

3
$\begingroup$

3DES encryption chains 3 DES operations with 3 different DES keys $K_1$, $K_2$, $K_3$ (each 8-octet with 1 bit ignored per octet) together forming the key of 3DES (24-octet with 168-bit key), to transforms the plaintext $P$ (64-bit) into ciphertext $C$ (64-bit), as defined by equation [A]: $$C\gets\operatorname{E_3}(K_1\|K_2\|K_3,P)=\operatorname{E}(K_3,\operatorname{D}(K_2,\operatorname{E}(K_1,P)))$$ where $\operatorname{E}$ and $\operatorname{D}$ are DES encryption and decryption, and $\operatorname{E_3}$ is the newly defined 3DES encryption. We'll show rigorously that applying decryption in the middle of that, with a key $K_2$ unrelated to key $K_1$ in the earlier step, is well-defined (that would not hold for typical asymmetric cipher).

A decryption operation $\operatorname{D_3}$ is defined by equation [B]: $$P\gets\operatorname{D_3}(K_1\|K_2\|K_3,C)=\operatorname{D}(K_1,\operatorname{E}(K_2,\operatorname{D}(K_3,C)))$$ The three layers of encryption are peeled out one by one, in reverse order. We'll show rigorously that it gets back to the original plaintext.

Our proofs will hold for any block cipher, without looking at the internals of DES.


Preliminaries:

  1. DES decryption undoes an encryption; that is, for any key $K$ and any 64-bit block $X$, deciphering $\operatorname{E}(K,X)$ with key $K$ is well-defined and $\operatorname{D}(K,\operatorname{E}(K,X))=X$. That's a basic property of any block cipher.
  2. DES encryption undoes a decryption, and that's well-defined for any input; that is, for any key $K$ and any 64-bit block $Y$, $\operatorname{E}(K,\operatorname{D}(K,Y))=Y$.

Proof of [2.]:

  • For any key $K$, encryption with that key $K$ of any 64-bit block $X$ gives a 64-bit block. This is reversible, thus different $X$ and $X'$ give different outcomes $\operatorname{E}(K,X)$ and $\operatorname{E}(K,X')$. Proof by contraposition:

    • If the outcome were the same, we'd have $\operatorname{E}(K,X)=\operatorname{E}(K,X')$
    • Applying decryption with key $K$ to that common quantity is well-defined, and we'd get $\operatorname{D}(K,\operatorname{E}(K,X))=\operatorname{D}(\operatorname{E}(K,X'))$
    • Applying [1.] twice, we get $X=X'$, completing the proof by contraposition.
  • Therefore, for any key $K$, the finite set of 64-bit blocks is fully reached by encryption with $K$, and any 64-bit block $Y$ is reached by some $X$, with $\operatorname{E}(K,X)=Y$. Proof can be by a counting argument, or by considering that the previous step has shown that transformation $X\to Y=\operatorname{E}(K,X)$ is an injective function from a finite set to the same finite set, thus a bijection.
  • Applying property [1.], it comes that deciphering $Y$ with key $K$ is well-defined, and $\operatorname{D}(K,Y)=X$.
  • By encrypting both sides with key $K$, we get that the $X$ exhibited above also verifies $\operatorname{E}(K,\operatorname{D}(K,Y))=\operatorname{E}(K,X)$.
  • The right hand side matches $Y$. Thus $\operatorname{E}(K,\operatorname{D}(K,Y))=Y$, completing the proof of [2.]

Proof that 3DES decryption $\operatorname{D_3}$ undoes 3DES encryption $\operatorname{E_3}$:

  • Replacing $C$ in formula [B] as defined in [A], we get $$\operatorname{D_3}(K_1\|K_2\|K_3,\operatorname{E_3}(K_1\|K_2\|K_3,P))\\ =\operatorname{D}(K_1,\operatorname{E}(K_2,\operatorname{D}(K_3,\operatorname{E}(K_3,\operatorname{D}(K_2,\operatorname{E}(K_1,P))))))$$
  • Applying [1.] with $K=K_3$ and $X=\operatorname{D}(K_2,\operatorname{E}(K_1,P))$, we get $$\operatorname{D_3}(K_1\|K_2\|K_3,\operatorname{E_3}(K_1\|K_2\|K_3,P))\\ =\operatorname{D}(K_1,\operatorname{E}(K_2,\operatorname{D}(K_2,\operatorname{E}(K_1,P))))$$
  • Applying [2.] with $K=K_2$ and $Y=\operatorname{E}(K_1,P)$, we get $$\operatorname{D_3}(K_1\|K_2\|K_3,\operatorname{E_3}(K_1\|K_2\|K_3,P))=\operatorname{D}(K_1,\operatorname{E}(K_1,P))$$
  • Applying [1.] with $K=K_1$ and $X=P$, we get the desired $$\operatorname{D_3}(K_1\|K_2\|K_3,\operatorname{E_3}(K_1\|K_2\|K_3,P))=P$$

3DES decryption is thus to 3DES encryption what DES decryption is to DES encryption; the main external difference between 3DES and DES being the larger key.

Because the plaintext is transformed more thoroughly than in DES, and with a larger key, reversing the encryption operation without knowledge of the key is more difficult in 3DES than in DES.

For why there is a decryption in the middle, see this answer.

$\endgroup$

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.