CMSG_CTRL_DECRYPT_PARA structure (wincrypt.h)

The CMSG_CTRL_DECRYPT_PARA structure contains information used to decrypt an enveloped message for a key transport recipient. This structure is passed to CryptMsgControl if the dwCtrlType parameter is CMSG_CTRL_DECRYPT.

For information about how CryptoAPI supports Secure/Multipurpose Internet Mail Extensions (S/MIME) email interoperability, see the Remarks section of CryptMsgOpenToEncode.

Syntax

typedef struct _CMSG_CTRL_DECRYPT_PARA {
  DWORD cbSize;
  union {
    HCRYPTPROV        hCryptProv;
    NCRYPT_KEY_HANDLE hNCryptKey;
  } DUMMYUNIONNAME;
  DWORD dwKeySpec;
  DWORD dwRecipientIndex;
} CMSG_CTRL_DECRYPT_PARA, *PCMSG_CTRL_DECRYPT_PARA;

Members

cbSize

The size, in bytes, of this structure.

DUMMYUNIONNAME

DUMMYUNIONNAME.hCryptProv

Cryptographic service provider (CSP) handle. The CNG function NCryptIsKeyHandle is called to determine the union choice.

DUMMYUNIONNAME.hNCryptKey

A handle to the CNG Cryptographic service provider (CSP). The CNG function, NCryptIsKeyHandle, is called to determine the union choice. New encrypt algorithms are only supported in CNG functions. The CNG function, NCryptTranslateHandle, will be called to convert the CryptoAPI hCryptProv choice where necessary. We recommend that applications pass, to the hNCryptKey member, the CNG CSP handle that is returned from the NCryptOpenKey function.

dwKeySpec

The private key to be used. This member is not used when the hNCryptKey member is used.

The following dwKeySpec values are defined for the default provider.

Value Meaning
AT_KEYEXCHANGE
Keys used to encrypt and decrypt session keys.
AT_SIGNATURE
Keys used to create and verify digital signatures.
 

If dwKeySpec is zero, the default AT_KEYEXCHANGE is used.

dwRecipientIndex

Index of the recipient in the message associated with the hCryptProv private key.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Header wincrypt.h

See also

CryptMsgControl