I am suppose to develop a SMIME based application in JAVA. These are certain areas where I need more clarification about SMIME en/de-crypttion. I understood how message encryption and decryption in case of a single recipient.
If There is only a single recipient
- A random generated session key used to encrypt message content.
- Then this random session key will be encrypted using receiver's public key then send SMIME message.
- The encrypted message will be decrypted using receiver's private key and retrieve the session key used to encrypt message in receiver side.
If there are multiple recipients are there, then
- A random generated session key used to encrypt message content.
- If a message is being sent to multiple recipients, the symmetric key is encrypted separately by every recipient's public key. The enveloped message and all encrypted symmetric keys are packaged together using the PKCS#7 format.
- Then this random session key will be encrypted using each receiver's public key then send SMIME message.
If multiple receivers encrypted session key come with same message,
- How the decryption in receiver side is done?
- Is the receiver iterate all encrypted session key and try to decrypt for session key?
- If there are 50 recipients, then does the receiver need to decrypt all recipient's encrypted text for session key?
Could anyone help me to find any useful resource or provide answer for my question?