The CMSG_CTRL_DECRYPT_PARA structure is used for an enveloped message. This structure is passed to CryptMsgControl for a value of CMSG_CTRL_DECRYPT in dwCtrlType.
Important changes have been made to the CryptoAPI in order to support S/MIME e-mail interoperability, which affect the handling of enveloped messages. See the Remarks for CryptMsgOpenToEncode for details.
typedef struct _CMSG_CTRL_DECRYPT_PARA {
DWORD cbSize;
HCRYPTPROV hCryptProv;
DWORD dwKeySpec;
DWORD dwRecipientIndex;
} CMSG_CTRL_DECRYPT_PARA, *PCMSG_CTRL_DECRYPT_PARA;
The following dwKeySpec values are defined in Wincrypt.h for the default provider:
#define AT_KEYEXCHANGE 1
#define AT_SIGNATURE 2
If dwKeySpec is zero, then the default AT_KEYEXCHANGE is used.