CryptSetProviderEx function
The CryptSetProviderEx function specifies the default cryptographic service provider (CSP) of a specified provider type for the local computer or current user.
Syntax
BOOL WINAPI CryptSetProviderEx( _In_ LPCTSTR pszProvName, _In_ DWORD dwProvType, _In_ DWORD *pdwReserved, _In_ DWORD dwFlags );
Parameters
- pszProvName [in]
-
The name of the new default CSP. This must be a CSP installed on the computer. For a list of available cryptographic providers, see Cryptographic Provider Names.
- dwProvType [in]
-
The provider type of the CSP specified by pszProvName.
- pdwReserved [in]
-
This parameter is reserved for future use and must be NULL.
- dwFlags [in]
-
The following flag values are defined.
Return value
If the function succeeds, the return value is nonzero (TRUE).
If the function fails, the return value is zero (FALSE). For extended error information, call GetLastError. Possible error codes include those shown in the following table.
| Return code | Description |
|---|---|
|
One of the parameters contains a value that is not valid. This is most often a pointer that is not valid. |
|
The operating system ran out of memory. |
Remarks
Most applications do not specify a CSP name when calling the CryptAcquireContext function; however, an application can specify a CSP name and thereby select a CSP with an appropriate level of security. Because calls to CryptSetProviderEx determine the CSP of a specified type used by all applications from that point on, CryptSetProviderEx must never be called without a user's consent.
Requirements
|
Minimum supported client |
Windows XP [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows Server 2003 [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names |
CryptSetProviderExW (Unicode) and CryptSetProviderExA (ANSI) |
See also