CMSG_KEY_TRANS_ENCRYPT_INFO structure (wincrypt.h)

The CMSG_KEY_TRANS_ENCRYPT_INFO structure contains encryption information for a key transport recipient of enveloped data. The PFN_CMSG_EXPORT_KEY_TRANS function updates this structure.

Syntax

typedef struct _CMSG_KEY_TRANS_ENCRYPT_INFO {
  DWORD                      cbSize;
  DWORD                      dwRecipientIndex;
  CRYPT_ALGORITHM_IDENTIFIER KeyEncryptionAlgorithm;
  CRYPT_DATA_BLOB            EncryptedKey;
  DWORD                      dwFlags;
} CMSG_KEY_TRANS_ENCRYPT_INFO, *PCMSG_KEY_TRANS_ENCRYPT_INFO;

Members

cbSize

The size, in bytes, of this structure.

dwRecipientIndex

A value that specifies the ordinal number of a recipient in the recipient list specified by the pContentEncryptInfo parameter of the PFN_CMSG_EXPORT_KEY_TRANS function.

KeyEncryptionAlgorithm

A CRYPT_ALGORITHM_IDENTIFIER structure that specifies the algorithm of the recipient public key. The CryptMsgOpenToEncode function uses the pszObjId member of the CRYPT_ALGORITHM_IDENTIFIER structure to get the address of the function used to export the key. The function can be installed by using a Cryptography API: Next Generation (CNG) object identifier (OID).

EncryptedKey

A CRYPT_DATA_BLOB structure that contains the session key encrypted by the public key of the recipient.

dwFlags

A value that specifies what members have been updated, and whose memory allocation must be freed by using the CryptMsgOpenToEncode function.

Value Meaning
CMSG_KEY_TRANS_ENCRYPT_FREE_OBJID_FLAG
0x00000002
The pszObjId member of the CRYPT_ALGORITHM_IDENTIFIER structure referred to by the KeyEncryptionAlgorithm member was updated.
CMSG_KEY_TRANS_ENCRYPT_FREE_PARA_FLAG
0x00000001
The Parameters pbData member of the CRYPT_ALGORITHM_IDENTIFIER structure referred to by the KeyEncryptionAlgorithm member was updated.

Remarks

When called with the dwMsgType parameter set to CMSG_ENVELOPED, the CryptMsgOpenToEncode function initializes the CMSG_KEY_TRANS_ENCRYPT_INFO structure from the CMSG_KEY_TRANS_RECIPIENT_ENCODE_INFO structure. The CryptMsgOpenToEncode function calls the PFN_CMSG_EXPORT_KEY_TRANS function to update the CMSG_KEY_TRANS_ENCRYPT_INFO structure. If the callback function cannot be found, the CryptMsgOpenToEncode function fills this structure with default key information from the CMSG_CONTENT_ENCRYPT_INFO structure.

The following members of the CMSG_KEY_TRANS_ENCRYPT_INFO structure can be updated by the callback function:

EncryptedKey
KeyEncryptionAlgorithm.pszObjId
KeyEncryptionAlgorithm.Parameters
dwFlags

The other members are read-only.

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

Encoding Enveloped Data