Creating an Encrypted Message

The following illustration depicts the individual tasks that must be accomplished to encrypt a message, as shown in the list that follows it.

    To encrypt a message
  1. Get a pointer to the plaintext message.
  2. Generate a symmetric (session) key.
  3. Using the symmetric key and specified encryption algorithm, encrypt the message data.
  4. Open a certificate store.
  5. Get the recipient's certificate.
  6. Get the public key from the recipient's certificate .
  7. Using the recipient's public key, encrypt the symmetric key.
  8. Get the recipient's ID from the recipient's certificate .
  9. Include the following in the digitally enveloped message: the data encryption algorithm, the encrypted data, the encrypted symmetric key, and the recipient ID.