EN
Il contenuto non è disponibile nella lingua di destinazione, ma solo in inglese.

CryptSetProvider function

The CryptSetProvider function specifies the current user's default cryptographic service provider (CSP).

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.

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

Syntax


BOOL WINAPI CryptSetProvider(
  _In_  LPCTSTR pszProvName,
  _In_  DWORD dwProvType
);

Parameters

pszProvName [in]

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.

dwProvType [in]

Provider type of the CSP specified by pszProvName.

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. Some possible error codes are listed in the following table.

Return codeDescription
ERROR_INVALID_HANDLE

One of the parameters specifies a handle that is not valid.

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 during the operation.

 

Errors can also be propagated from internal calls to RegCreateKeyEx and RegSetValueEx.

Remarks

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.

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

CryptSetProviderW (Unicode) and CryptSetProviderA (ANSI)

See also

Cryptographic Provider Names
Service Provider Functions
CryptAcquireContext
RegCreateKeyEx
RegSetValueEx

 

 

Aggiunte alla community

AGGIUNGI
Mostra:
© 2014 Microsoft