NCryptOpenStorageProvider function

The NCryptOpenStorageProvider function loads and initializes a CNG key storage provider.

Syntax


SECURITY_STATUS WINAPI NCryptOpenStorageProvider(
  _Out_     NCRYPT_PROV_HANDLE *phProvider,
  _In_opt_  LPCWSTR pszProviderName,
  _In_      DWORD dwFlags
);

Parameters

phProvider [out]

A pointer to a NCRYPT_PROV_HANDLE variable that receives the provider handle. When you have finished using this handle, release it by passing it to the NCryptFreeObject function.

pszProviderName [in, optional]

A pointer to a null-terminated Unicode string that identifies the key storage provider to load. This is the registered alias of the key storage provider. This parameter is optional and can be NULL. If this parameter is NULL, the default key storage provider is loaded. The following values identify the built-in key storage providers.

ValueMeaning
MS_KEY_STORAGE_PROVIDER
L"Microsoft Software Key Storage Provider"

Identifies the software key storage provider that is provided by Microsoft.

MS_SMART_CARD_KEY_STORAGE_PROVIDER
L"Microsoft Smart Card Key Storage Provider"

Identifies the smart card key storage provider that is provided by Microsoft.

 

dwFlags [in]

Flags that modify the behavior of the function. No flags are defined for this function.

Return value

Returns a status code that indicates the success or failure of the function.

Possible return codes include, but are not limited to, the following.

Return codeDescription
ERROR_SUCCESS

The function was successful.

NTE_BAD_FLAGS

The dwFlags parameter contains one or more flags that are not supported.

NTE_INVALID_PARAMETER

One or more parameters are not valid.

NTE_NO_MEMORY

A memory allocation failure occurred.

 

Remarks

In the case that an error condition is returned, the provider will have been unloaded from memory. Functions within the provider must not be called after a failure error is returned.

A service must not call this function from its StartService Function. If a service calls this function from its StartService function, a deadlock can occur, and the service may stop responding.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

Ncrypt.h

Library

Ncrypt.lib

DLL

Ncrypt.dll

 

 

Community Additions

ADD
Show:
© 2014 Microsoft