# Encrypt symmetric key or message first PGP?

I understand the concept of the hybrid-cryptosystem that OpenPGP uses by generating a random symmetric key, using that to encrypt the message before encrypting itself with the recipient's public key.

However, in this paper describing OpenPGP, it describes the process the other way: encrypting the symmetric key, before using that encrypted key to encrypt the message. Is this correct?

https://www.rfc-editor.org/rfc/rfc4880#section-2.1

The step explained in the paper is correct. The confusion you probably are facing is with the key exchange step I guess.

Let me explain it further.

Let A be the sender and B, the recipient.

• A generates the message - M
• A generates a pseudorandom session key - K `Key for symmetric encryption`
• A encrypts the message M with session key K - E(K,M) `Message encrypted with symmetric encryption`
• A encrypts the session key K with public key of B - E(KBPUB, K) `K encrypted with public key of B so that B can retrieve K with it's private key.`
• A appends the results of step 3 and 4 and sends it to B - E(K,M) || E(KBPUB, K)

• B receives E(K,M) || E(KBPUB, K)

• B retrieves K from E(KBPUB, K) -> K = E[KBPRIV, E(KBPUB, K)] `Retrieving K by decrypting it with private key of B.`
• B uses K to retrieve M from E(K,M) -> M = D[K, E(K,M)] `Decrypting the symmetrically encrypted message.`

Your confusion is in the 3rd and 4th steps. Te order of 3rd and 4th steps doesn't matter as you see from the above.

• I think the confusion was from me thinking that it was using the encrypted symmetric key to encrypt the message, but instead they both use the original session key instead Commented Nov 7, 2016 at 21:04