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:
- 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.
- 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.
vote
should be applied with a comment. $\endgroup$