Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This structure contains information needed to encode an enveloped message. It is passed to CryptMsgOpenToEncodeif dwMsgTypeis CMSG_ENVELOPED.
Syntax
typedef struct _CMSG_ENVELOPED_ENCODE_INFO { DWORD cbSize; HCRYPTPROV hCryptProv; CRYPT_ALGORITHM_IDENTIFIER ContentEncryptionAlgorithm; void* pvEncryptionAuxInfo; DWORD cRecipients; PCERT_INFO* rgpRecipients; PCMSG_RECIPIENT_ENCODE_INFO rgCmsRecipients; DWORD cCertEncoded; PCERT_BLOB rgCertEncoded; DWORD cCrlEncoded; PCRL_BLOB rgCrlEncoded; DWORD cAttrCertEncoded; PCERT_BLOB rgAttrCertEncoded; DWORD cUnprotectedAttr; PCRYPT_ATTRIBUTE rgUnprotectedAttr; } CMSG_ENVELOPED_ENCODE_INFO, *PCMSG_ENVELOPED_ENCODE_INFO; |
Members
- cbSize
-
Size of this structure in bytes.
- hCryptProv
-
Specifies a handle to the cryptographic service provider (CSP) used to do content encryption, recipient key encryption, and export. The hCryptProv's private keys are not used.
Unless there is a strong reason for passing in a specific cryptographic provider in hCryptProv, pass zero to use the default RSA or DSS provider.
- ContentEncryptionAlgorithm
-
CRYPT_ALGORITHM_IDENTIFIERstructure contains the signature algorithm type and any associated additional parameters in encoded form.
The pszObjIdmember of the structure specifies the algorithm used to encrypt the message contents.
The following encryption algorithms require an encoded eight byte initialization vector (IV) in the Parametersmember of structure. For details, see CryptSetKeyParam.
Value Description CALG_DES
szOID_OIWSEC_desCBC
CALG_3DES
szOID_RSA_DES_EDE3_CBC
If the cbDatamember of the Parametersmember is zero, an ASN.1 encoded OCTET STRING containing the IV is generated using CryptGenRandom.
The szOID_RSA_RC2CBC (CALG_RC2) algorithm requires the pbData member of Parameters to be an encoded CRYPT_RC2_CBC_PARAMETERS structure. If the cbDatamember of the Parametersmember is zero, an ASN.1 encoded CRYPT_RC2_CBC_PARAMETERS is generated with a default value of 40 for the dwVersionmember. This sets the default key length to 40 bits. This default key length can be overridden with pvEncryptionAuxInfopointing to a CMSG_RC2_AUX_INFO structure containing the desired key length.
Note: On decryption, if an IV exists, CryptSetKeyParamis called with the IV before decryption begins.
- pvEncryptionAuxInfo
-
Pointer to a structure depending on the encryption algorithm.
Value Description RC2
CMSG_RC2_AUX_INFO
RC4
CMSG_RC4_AUX_INFO
SP3 or compatible
CMSG_SP3_COMPATIBLE_AUX_INFO
All other encryption algorithms
NULL
- cRecipients
-
Number of elements in the rgpRecipientsor rgCmsRecipientsarray.
- rgpRecipients
-
Pointer to an array of CERT_INFOstructures, each containing a recipient's certificate Issuer, SerialNumber, and SubjectPublicKeyInfo. This array can only be used for recipients identified by their Issuer and serial number. If rgpRecipientsis not NULL, rgCmsRecipientsmust be NULL.
- rgCmsRecipients
-
This member can optionally be defined with Windows 2000 and later. Pointer to an array of CMSG_RECIPIENT_ENCODE_INFO structures, each containing recipient information. If rgCmsRecipientsis not NULL, rgpRecipientsmust be NULL. CMSG_ENVELOPED_ENCODE_INFO_HAS_CMS_FIELDS must be defined to reference this field.
- cCertEncoded
-
This member can optionally be defined with Windows 2000 and later. DWORDindicating the number of encoded certificates in the rgCertEncodedarray. CMSG_ENVELOPED_ENCODE_INFO_HAS_CMS_FIELDS must be defined to reference this field.
- rgCertEncoded
-
This member can optionally be defined with Windows 2000 and later. Pointer to an array of CERT_BLOBstructures. CMSG_ENVELOPED_ENCODE_INFO_HAS_CMS_FIELDS must be defined to reference this field.
- cCrlEncoded
-
This member can optionally be defined with Windows 2000 and later. DWORDindicating the number of encoded CRLs in the rgCRLEncodedarray. CMSG_ENVELOPED_ENCODE_INFO_HAS_CMS_FIELDS must be defined to reference this field.
- rgCrlEncoded
-
This member can optionally be defined with Windows 2000 and later. Pointer to an array of CRL_BLOBstructures. CMSG_ENVELOPED_ENCODE_INFO_HAS_CMS_FIELDS must be defined to reference this field.
- cAttrCertEncoded
-
This member can optionally be defined with Windows 2000 and later. DWORDindicating the number of encoded certificate attributes in the rgAttrCertEncodedarray. CMSG_ENVELOPED_ENCODE_INFO_HAS_CMS_FIELDS must be defined to reference this field.
- rgAttrCertEncoded
-
This member can optionally be defined with Windows 2000 or later. Pointer to an array of CRYPT_ATTRIBUTEstructures. CMSG_ENVELOPED_ENCODE_INFO_HAS_CMS_FIELDS must be defined to reference this member.
- cUnprotectedAttr
-
This member can optionally be defined with Windows 2000 and later. DWORDindicating the number of unprotected attributes in the rgUnprotectedAttrarray. CMSG_ENVELOPED_ENCODE_INFO_HAS_CMS_FIELDS must be defined to reference this field.
- rgUnprotectedAttr
-
This member can optionally be defined with Windows 2000 and later. Pointer to an array of CRYPT_ATTRIBUTEstructures. CMSG_ENVELOPED_ENCODE_INFO_HAS_CMS_FIELDS must be defined to reference this field.
Remarks
CMSG_ENVELOPED_ENCODE_INFO_HAS_CMS_FIELDS must be defined to reference the following structure members:
rgCmsRecipients
cCertEncoded
rgCertEncoded
cCrlEncoded
rgCrlEncoded
cAttrCertEncoded
rgAttrCertEncoded
cUnprotectedAttr
rgUnprotectedAttr
Requirements
Header | wincrypt.h |
Windows Embedded CE | Windows CE .NET 4.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |