CRYPT_KEY_PROV_INFO

This structure contains fields that are passed as arguments to the CryptAcquireContext function to acquire a handle to a particular key container within a particular cryptographic service provider (CSP) or to create or destroy a key container.

typedef struct _CRYPT_KEY_PROV_INFO {LPWSTRpwszContainerName;LPWSTRpwszProvName;DWORDdwProvType;DWORDdwFlags;DWORDcProvParam;PCRYPT_KEY_PROV_PARAMrgProvParam;DWORDdwKeySpec;} CRYPT_KEY_PROV_INFO, *PCRYPT_KEY_PROV_INFO;

Members

  • pwszContainerName
    String naming a key container within a particular CSP.

  • pwszProvName
    String that names a CSP.

  • dwProvType
    CSP type. This member can be set to the following values:

    • PROV_RSA_FULL
    • PROV_RSA_SIG
    • PROV_DSS
    • PROV_FORTEZZA
    • PROV_MS_EXCHANGE
    • PROV_SSL
    • PROV_RSA_SCHANNEL
    • PROV_DSS_DH
    • PROV_DH_SCHANNEL
  • dwFlags
    Values indicating whether a key container is to be created or destroyed and whether an application is allowed access to a key container.

    The following table shows flags that are defined and must not collide with any CryptAcquireContext function dwFlags definitions.

    Flag value Description
    CERT_SET_KEY_PROV_HANDLE_PROP_ID Enables the handle to the key provider to be kept open for subsequent calls to the cryptographic functions.
    CERT_SET_KEY_CONTEXT_PROP_ID Enables the handle to the key provider to be kept open for subsequent calls to the cryptographic functions.

    See the CryptAcquireContext function for the list of the flags passed through. The flags listed in the previous table are cleared before the CryptAcquireContext function is called. The cryptographic functions CryptDecryptMessage, CryptSignMessage, CryptDecryptAndVerifyMessageSignature, and CryptSignAndEncryptMessage internally perform CryptAcquireContext operations using CRYPT_KEY_PROV_INFO from a certificate. When the CERT_SET_KEY_CONTEXT_PROP_ID or CERT_SET_KEY_PROV_HANDLE_PROP_ID flag is set, these cryptographic functions then can call CertSetCertificateContextProperty (CERT_KEY_CONTEXT_PROP_ID). This call enables the handle to the key provider to be kept open for subsequent calls to the cryptographic functions mentioned that use that same certificate, which eliminates the need to perform another CryptAcquireContext, improving efficiency. Also, because some providers can require that a password be entered for calls to CryptAcquireContext, it is desirable for applications to minimize the number of CryptAcquireContext calls made. Handles to key providers that were kept open are automatically released when the store is closed.

    For example, consider an e-mail application where five encrypted messages have been received, all encrypted with the public key from the same certificate. If the handle to the key provider is kept open after the first message is processed, calls to CryptAcquireContext are not required for the four remaining messages.

  • cProvParam
    Number of elements in the rgProvParam array.

  • rgProvParam
    Array of pointers to CRYPT_KEY_PROV_PARAM structures.

  • dwKeySpec
    Specification of the private key to retrieve. The following table shows values for the dwKeySpec member that are defined for the default provider.

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

Requirements

OS Versions: Windows CE 3.0 and later.
Header: Wincrypt.h.

See Also

CertGetCertificateContextProperty | CertSetCertificateContextProperty | CryptAcquireContext | CRYPT_KEY_PROV_PARAM

 Last updated on Thursday, April 08, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.