CryptSetProviderExA function (wincrypt.h)
Syntax
BOOL CryptSetProviderExA(
[in] LPCSTR pszProvName,
[in] DWORD dwProvType,
[in] DWORD *pdwReserved,
[in] DWORD dwFlags
);
Parameters
[in] pszProvName
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.
[in] dwProvType
The provider type of the CSP specified by pszProvName.
[in] pdwReserved
This parameter is reserved for future use and must be NULL.
[in] dwFlags
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.
Note
The wincrypt.h header defines CryptSetProviderEx as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows XP [desktop apps only] |
Minimum supported server | Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | wincrypt.h |
Library | Advapi32.lib |
DLL | Advapi32.dll |