10.01.2003 12:21:02программирование Ответов: 1
Подскажите как программно изменить CSP установленный по умолчанию в виндах
10.01.2003 15:59:01kure

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.

BOOL WINAPI CryptSetProvider(
LPCTSTR pszProvName,
DWORD dwProvType

[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.
[in] Provider type of the CSP specified by pszProvName.
Return Values
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.

Value Meaning
ERROR_INVALID_HANDLE One of the parameters specifies an invalid handle.
ERROR_INVALID_PARAMETER One of the parameters contains an invalid value. This is most often an invalid pointer.
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.

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.

Windows NT/2000/XP: Included in Windows NT 4.0 and later.
Windows 95/98/Me: Included in Windows 95 OSR2 and later.
Redistributable: Requires Internet Explorer 3.02 or later on Windows 95.
Unicode: Implemented as Unicode and ANSI versions on all platforms.
Header: Declared in Wincrypt.h.
Library: Use Advapi32.lib.