Compartir a través de


CryptSetProvParam (Windows Embedded CE 6.0)

1/6/2010

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.

Syntax

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

Parameters

  • 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 isPP_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 Value

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

Header wincrypt.h
Library coredll.lib
Windows Embedded CE Windows CE 2.10 and later

See Also

Reference

Cryptography Functions
CryptAcquireContext
CryptGetProvParam
CryptSetKeyParam