Compartir a través de


CryptSetProvParam (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( HCRYPTPROV hProv,DWORD dwParam,BYTE* pbData,DWORD dwFlags);

Parameters

  • hProv
    [in] HCRYPTPROV handle to the CSP on which to set parameters. A call to the CryptAcquireContext function created the handle.

  • dwParam
    [in] Specifies the parameter value to set.

    The following table shows values that are currently defined.

    Value Description
    PP_CLIENT_HWND Specifies that pbData contains a window handle.
    PP_KEYSET_SEC_DESCR Specifies 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.

  • pbData
    [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.

  • dwFlags
    [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.

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

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.

Requirements

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.