If a current user's default provider is set, that default provider is acquired by any call by that user to CryptAcquireContext specifying a dwProvType provider type but not a CSP name.
An enhanced version of this function, CryptSetProviderEx, is also available.
BOOL CryptSetProviderA( LPCSTR pszProvName, DWORD dwProvType );
Name of the new default CSP. The named CSP must be installed on the computer. For a list of available cryptographic providers, see Cryptographic Provider Names.
Provider type of the CSP specified by pszProvName.
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. Some possible error codes are listed in the following table.
||One of the parameters specifies a handle that is not valid.|
||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 during the operation.|
Typical applications do not specify a CSP name when calling CryptAcquireContext; however, an application does have the option of selecting a specific CSP. This gives a user the freedom to select a CSP with an appropriate level of security.
Since calling CryptSetProvider determines the CSP of a specified type used by all applications that run from that point on, this function must not be called without users' consent.
|Minimum supported client||Windows XP [desktop apps only]|
|Minimum supported server||Windows Server 2003 [desktop apps only]|