CryptSetProvParam

This function customizes the operations of a cryptographic service provider (CSP).

At a Glance

Header file: Wincrypt.h
Windows CE versions: 2.10 and later

Syntax

BOOL CRYPTFUNC CryptoSetProvParam( HCRYPTPROV hProv,
DWORD
dwParam, BYTE *pbData, DWORD dwFlags );

Parameters

hProv

[in] Handle to the CSP on which to set parameters.

dwParam

[in] Specifies the parameter number to set. The following values are currently defined (see "Remarks" for additional details):

Value Description
PP_CLIENT_HWND Specifies that a window handle is contained in pbData.
PP_KEYSET_SEC_DESCR Specifies that the security descriptor on the entry where the stored key set is being assigned, and its value is contained in pbData.

pbData

[in] Pointer to the parameter data buffer. Place the parameter data in this buffer before calling CryptSetProvParam. The form of this data will vary, depending on the parameter number.

dwFlags

[in] Specifies a bitmask of flags. When dwParam is PP_KEYSET_SEC_DESCR, dwFlags contains the SECURITY_INFORMATION applicable bit flags (can be combined with a bitwise OR operation), as defined in the Win32 Programmer's Reference. See CryptGetProvParam for additional details.

Return Values

TRUE indicates success. FALSE indicates failure. To get extended error information, call GetLastError. Common values for GetLastError are described in the following table. The error values prefaced by "NTE" are generated by the particular CSP you are using.

Value Description
ERROR_INVALID_HANDLE One of the parameters specifies an invalid handle.
ERROR_BUSY The CSP context is currently being used by another process.
ERROR_INVALID_PARAMETER One of the parameters contains an invalid value. This is most often an illegal pointer.
NTE_BAD_FLAGS The dwFlags parameter is nonzero or the pbData buffer contains an invalid value.
NTE_BAD_TYPE The dwParam parameter specifies an unknown parameter.
NTE_BAD_UID The CSP context that was specified when the hKey key was created cannot be found.
NTE_FAIL The function failed in some unexpected way.

Remarks

Microsoft Cryptographic Service Providers do not support the PP_CLIENT_HWND or PP_KEYSET_SEC_DESCR flags.

See Also

CryptAcquireContext, CryptGetProvParam, CryptSetKeyParam