# Multiple public key encryption

Sorry for the newby question but would this work: Alice encrypts a message X with John's public key to form Y. Alice then encrypts Y with Bob's public key to form Z. Alice then sends Z to Bob and John.

Would I be correct in assuming that to decrypt Z, Bob would have to use his private key on Z to get Y. After this John would have to decrypt Y with his private key to get X?

Thanks

• John would have to decrypt Y (and not Z) with his private key to get X. – Occams_Trimmer Aug 31 '17 at 15:23
• I corrected the typo – Guut Boy Sep 22 '17 at 9:35

No. Alice encrypted X by John's public key to have Y. e.g. Enc(key_John, X)= Y. So the only work that John is able to do is decrypting Y by his private key to have X.

Generaly, first Alice here has encrypted X by John's key, then encrypted the result by Bob's key. Therefore both Bob and John have recieved: Enc(key_Bob, Enc(key_John, X))

So to get X again from Z, you must first achieve Y from Z( by decrypting Z via Bob's key), then achieve X from Y ( by decrypting computed Y via John's key). which means:

Dec(key_John, Dec(key_Bob, Enc(key_Bob, Enc(key_John, X)))

Note that each person only can decrypt the message which is encrypted by his key.

• Thanks for the detailed description. As I said to Squeamish Ossifrage below, there was a typo on my part. Glad that you stepped through the logic though -- nice answer! – Steve Sep 1 '17 at 5:22

Yes, assuming you made a typo and meant ‘John would have to decrypt Y’.

• The answer is simply ‘yes’. The rest was there only because e-sushi asked me to elaborate and there are limits on the brevity of an answer. If the problem is that the question was fundamentally a yes-or-no question, that's not my fault! – Squeamish Ossifrage Sep 6 '17 at 13:49