Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Decrypting Data

This section presents the steps to decrypt an encrypted message.

Aa381959.wedge(en-us,VS.85).gifTo decrypt an encrypted message

  1. Get a pointer to the digitally enveloped message.
  2. Open a certificate store.
  3. From the message, retrieve the recipient identifier (My ID).
  4. Use the recipient identifier to retrieve the certificate.
  5. Get the private key for the certificate.
  6. Use the private key to decrypt the symmetric (session) key.
  7. Retrieve the encryption algorithm from the message.
  8. Using the decrypted session key and the encryption algorithm, decrypt the data.

CryptDecryptMessage does all of the tasks for decrypting a message; however, initialization of structures and other data is still necessary.

Aa381959.wedge(en-us,VS.85).gifTo decrypt data using CryptDecryptMessage

  1. Get a pointer to the encrypted BLOB.
  2. Open a certificate store.
  3. Create a certificate store array.
  4. Initialize the CRYPT_DECRYPT_MESSAGE_PARA structure.
  5. Call CryptDecryptMessage to decrypt the data contained in the message.

Example C Program: Using CryptEncryptMessage and CryptDecryptMessage implements the procedure just presented. Comments show which code elements accomplish each step in the procedure. For details about the function, see CryptDecryptMessage, and for details about the data structure, see CRYPT_DECRYPT_MESSAGE_PARA.

 

 

Community Additions

ADD
Show:
© 2015 Microsoft