CryptSetProvParam (Windows CE 5.0)

Windows CE 5.0
Send Feedback

This function customizes the operations of a cryptographic service provider (CSP). This function is commonly used to set a security descriptor on the key container associated with a CSP to control access to the private keys in that key container.

BOOL CRYPTFUNC CryptSetProvParam( 
  DWORD dwParam, 
  BYTE* pbData, 
  DWORD dwFlags


[in] HCRYPTPROV handle to the CSP on which to set parameters. A call to the CryptAcquireContext function created the handle.
[in] Specifies the parameter value to set.

The following table shows values that are currently defined.

PP_CLIENT_HWNDSpecifies that pbData contains a window handle.
PP_KEYSET_SEC_DESCRSpecifies that pbData contains the security descriptor on the entry where the stored key set is being assigned.

Microsoft CSPs do not support the PP_CLIENT_HWND or PP_KEYSET_SEC_DESCR flags.

[in] Pointer to the parameter data buffer. The value in this buffer must be set before calling the CryptSetProvParam function. The form of this data varies depending on the parameter value.
[in] Bitmask of flags. When dwParam is PP_KEYSET_SEC_DESCR, dwFlags contains the SECURITY_INFORMATION, as defined in the Win32 Programmer's Reference.

These bit flags can be combined with a bitwise OR operator. For more information, see CryptGetProvParam.

Return Values

TRUE indicates success. FALSE indicates failure. To get extended error information, call the GetLastError function.

The following table shows the common values for the GetLastError function. The error values prefaced by NTE are generated by the particular CSP you are using.

ERROR_INVALID_HANDLEOne of the parameters specifies an invalid handle.
ERROR_BUSYThe CSP context is currently being used by another process.
ERROR_INVALID_PARAMETEROne of the parameters contains an invalid value. This is most often an illegal pointer.
NTE_BAD_FLAGSThe dwFlags parameter is nonzero or the pbData buffer contains an invalid value.
NTE_BAD_TYPEThe dwParam parameter specifies an unknown parameter.
NTE_BAD_UIDThe CSP context that was specified when the hKey key was created cannot be found.
NTE_FAILThe function failed in some unexpected way.


If dwParam is PP_CLIENT_HWND, the pbData buffer contains a DWORD value specifying the window handle that the provider uses when interacting directly with the user. The CryptSetProvParam function must be called before calling the CryptAcquireContext function because many CSPs display a user interface during the CryptAcquireContext function call. Use zero for the hProv parameter in the call to the CryptSetProvParam function. If this is done, the parameter is set for all cryptographic contexts subsequently acquired within this process.


OS Versions: Windows CE 2.10 and later.
Header: Wincrypt.h.
Link Library: Coredll.lib.

See Also

CryptAcquireContext | CryptGetProvParam | CryptSetKeyParam

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.