PvkPrivateKeySave function

Important  This API is deprecated. Microsoft may remove this API in future releases.
The PvkPrivateKeySave function saves a private key and its corresponding public key to a specified file.
Note  This function has no associated header file or import library. To call this function, you must create a user-defined header file and use the LoadLibrary and GetProcAddress functions to dynamically link to Mssign32.dll.


BOOL WINAPI PvkPrivateKeySave(
  _In_ HCRYPTPROV hCryptProv,
  _In_ HANDLE     hFile,
  _In_ DWORD      dwKeySpec,
  _In_ HWND       hwndOwner,
  _In_ LPCWSTR    pwszKeyName,
  _In_ DWORD      dwFlags


hCryptProv [in]

A handle to a cryptographic service provider (CSP).

hFile [in]

A handle to a file created with initial read/write permission and subsequent read-only permission.

dwKeySpec [in]

A long integer for the type of key. Possible values include AT_KEYEXCHANGE or AT_SIGNATURE.

hwndOwner [in]

If a password is required to encrypt the private key, this parameter is a handle to the parent of the dialog box; otherwise, it is NULL.

pwszKeyName [in]

A pointer to a null-terminated string for the name of the key to be saved.

dwFlags [in]

A DWORD value that specifies additional options for the function. For more information, see the dwFlags parameter in CryptExportKey.

Return value

Upon success, this function returns TRUE. The PvkPrivateKeySave function returns FALSE if it fails.


Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]