Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
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
- hProv
-
[in] HCRYPTPROVhandle to the CSP on which to set parameters. A call to the CryptAcquireContextfunction 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 pbDatacontains a window handle.
PP_KEYSET_SEC_DESCR
Specifies that pbDatacontains 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 CryptSetProvParamfunction. The form of this data varies depending on the parameter value.
- dwFlags
-
[in] Bitmask of flags. When dwParamisPP_KEYSET_SEC_DESCR, dwFlagscontains the SECURITY_INFORMATION, as defined in the Win32 Programmer's Reference.
These bit flags can be combined with a bitwise ORoperator. For more information, see CryptGetProvParam.
Return Value
TRUE indicates success. FALSE indicates failure. To get extended error information, call the GetLastErrorfunction.
The following table shows the common values for the GetLastErrorfunction. 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 dwFlagsparameter is nonzero or the pbDatabuffer contains an invalid value. |
NTE_BAD_TYPE |
The dwParamparameter specifies an unknown parameter. |
NTE_BAD_UID |
The CSP context that was specified when the hKeykey was created cannot be found. |
NTE_FAIL |
The function failed in some unexpected way. |
Remarks
If dwParamis PP_CLIENT_HWND, the pbDatabuffer contains a DWORDvalue specifying the window handle that the provider uses when interacting directly with the user. The CryptSetProvParamfunction must be called before calling the CryptAcquireContextfunction because many CSPs display a user interface during the CryptAcquireContextfunction call. Use zero for the hProvparameter in the call to the CryptSetProvParamfunction. 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 |
Windows Mobile | Windows Mobile Version 5.0 and later |