Export (0) Print
Expand All
Expand Minimize

CryptSetProviderEx function

The CryptSetProviderEx function specifies the default cryptographic service provider (CSP) of a specified provider type for the local computer or current user.

Note  Typical applications do not use this function. It is intended for use solely by administrative applications.

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.

ValueMeaning
CRYPT_DELETE_DEFAULT
0x00000004

Can be used in conjunction with CRYPT_MACHINE_DEFAULT or CRYPT_USER_DEFAULT to delete the default.

CRYPT_USER_DEFAULT
0x00000002

Causes the user-context default CSP of the specified type to be set.

CRYPT_MACHINE_DEFAULT
0x00000001

Causes the computer default CSP of the specified type to be set.

 

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 codeDescription
ERROR_INVALID_PARAMETER

One of the parameters contains a value that is not valid. This is most often a pointer that is not valid.

ERROR_NOT_ENOUGH_MEMORY

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

Wincrypt.h

Library

Advapi32.lib

DLL

Advapi32.dll

Unicode and ANSI names

CryptSetProviderExW (Unicode) and CryptSetProviderExA (ANSI)

See also

Service Provider Functions
CryptAcquireContext
CryptSetProvider

 

 

Community Additions

ADD
Show:
© 2014 Microsoft