共用方式為


CMSG_ENVELOPED_ENCODE_INFO

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This structure contains information needed to encode an enveloped message. It is passed to CryptMsgOpenToEncode if dwMsgType is 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_IDENTIFIER structure contains the signature algorithm type and any associated additional parameters in encoded form.

    The pszObjId member 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 Parameters member of structure. For details, see CryptSetKeyParam.

    Value Description

    CALG_DES

    szOID_OIWSEC_desCBC

    CALG_3DES

    szOID_RSA_DES_EDE3_CBC

    If the cbData member of the Parameters member 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 cbData member of the Parameters member is zero, an ASN.1 encoded CRYPT_RC2_CBC_PARAMETERS is generated with a default value of 40 for the dwVersion member. This sets the default key length to 40 bits. This default key length can be overridden with pvEncryptionAuxInfo pointing to a CMSG_RC2_AUX_INFO structure containing the desired key length.

    Note

    On decryption, if an IV exists, CryptSetKeyParam is 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 rgpRecipients or rgCmsRecipients array.
  • rgpRecipients
    Pointer to an array of CERT_INFO structures, 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 rgpRecipients is not NULL, rgCmsRecipients must 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 rgCmsRecipients is not NULL, rgpRecipients must 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. DWORD indicating the number of encoded certificates in the rgCertEncoded array. 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_BLOB structures. 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. DWORD indicating the number of encoded CRLs in the rgCRLEncoded array. 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_BLOB structures. 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. DWORD indicating the number of encoded certificate attributes in the rgAttrCertEncoded array. 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_ATTRIBUTE structures. 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. DWORD indicating the number of unprotected attributes in the rgUnprotectedAttr array. 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_ATTRIBUTE structures. 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

See Also

Reference

Cryptography Structures
CERT_INFO
CRYPT_ALGORITHM_IDENTIFIER