# How can 3DES encryption use decryption in the middle step?

I have been reading about the 3DES algorithm and I cannot understand one part. In 3DES we do following operation: $$C=E[K_3,D[K_2,E[K_1,P]]].$$ Where $C$ is ciphertext, $P$ is plaintext, $E$ is DES encryption and $D$ is DES decryption.

In the second part we have the decryption with $K_2$. How can we decrypt a cipher with one key ($K_2$) which was encrypted with another one ($K_1$)?

-

## migrated from security.stackexchange.comJun 5 '12 at 17:44

This question came from our site for information security professionals.

Perhaps this question is better asked at the crypto portion of stackexchange? – Terry Chia Jun 5 '12 at 10:28
Yeah I know, I found the crypto website after IT security but I had already asked in this website. – Erfan Jun 5 '12 at 10:30
Welcome to Cryptography Stack Exchange. Your question was migrated here, since it touches the more theoretical part of crypto, not so much the security implications thereof. I edited your question to be more clear. If you register your account here, too (using the same OpenID as on Security.SE), you'll get ownership of your question again and will be able to edit and comment. – Paŭlo Ebermann Jun 5 '12 at 20:19

I do not understand how can we decrypt a cypher which was encrypted with $K_1$, with $K_2$.
Triple DES essentially involves three encryptions on the plain text. First is using $K_1$, second using $K_2$, and third using $K_3$. Now one may argue that $K_2$ is not being used for encryption but decryption. Well, technically speaking, encryption and decryption are just the same, and are only the reverse of each other in all ciphers using the feistel cipher structure. So actually decryption with $K_2$ does nothing but jumble-up the message further more. We are not decrypting the cipher in the real sense. We are adding another layer of obscurity with a second key.
Actually, encryption and decryption are not the same, but are (given a fixed key) different bijective operations on the set of all blocks ($\{0,1\}^{64}$ for DES). They should be the inverses of each other to be called "encryption" and "decryption", though. Also, welcome to Cryptography Stack Exchange. If you register your account here (using the same OpenID as on security.SE), you can take ownership of your post again, edit it and comment. – Paŭlo Ebermann Jun 5 '12 at 20:25