Expand Minimize
EN
Deze inhoud is niet beschikbaar in uw taal, maar wel in het Engels.

CryptExportPKCS8Ex function

[The CryptExportPKCS8Ex function is no longer available for use as of Windows Server 2008 and Windows Vista. Instead, use the PFXExportCertStoreEx function.]

The CryptExportPKCS8Ex function exports the private key in PKCS #8 format. This function has no associated import library. You must use the LoadLibrary and GetProcAddress functions to dynamically link to Crypt32.dll.

Syntax


BOOL WINAPI CryptExportPKCS8Ex(
  _In_       CRYPT_PKCS8_EXPORT_PARAMS *psExportParams,
  _In_       DWORD dwFlags,
  _In_opt_   void *pvAuxInfo,
  _Out_opt_  BYTE *pbPrivateKeyBlob,
  _Inout_    DWORD *pcbPrivateKeyBlob
);

Parameters

psExportParams [in]

A pointer to a CRYPT_PKCS8_EXPORT_PARAMS structure that contains information about the key to export.

dwFlags [in]

This parameter should be zero if pbPrivateKeyBlob is NULL and 0x8000 otherwise.

pvAuxInfo [in, optional]

This parameter must be NULL.

pbPrivateKeyBlob [out, optional]

A pointer to an array of BYTE structures to receive the private key to be exported. The private key will contain the information in a PKCS #8 PrivateKeyInfo Abstract Syntax Notation One (ASN.1) type found in the PKCS #8 standard.

For memory allocation purposes, you can get the size of the private key to be exported by setting this parameter to NULL. For more information, see Retrieving Data of Unknown Length.

pcbPrivateKeyBlob [in, out]

A pointer to a DWORD that may contain, on input, the size, in bytes, of the memory allocation needed to contain the pbPrivateKeyBlob. If pbPrivateKeyBlob is NULL, this parameter will return the size of the memory allocation needed for a second call to the function. For more information, see Retrieving Data of Unknown Length.

Return value

If the function succeeds, the function returns nonzero (TRUE).

If the function fails, it returns zero (FALSE). For extended error information, call GetLastError.

The following error codes are specific to this function.

Return codeDescription
ERROR_UNSUPPORTED_TYPE

An export function that can be installed or registered could not be found.

ERROR_MORE_DATA

If the buffer specified by the pbPrivateKeyBlob parameter is not large enough to hold the returned data, the function sets the ERROR_MORE_DATA code and stores the required buffer size, in bytes, in the variable pointed to by the pcbPrivateKeyBlob parameter.

 

If the function fails, GetLastError returns an ASN.1 encoding/decoding error. For information about these errors, see ASN.1 Encoding/Decoding Return Values.

Remarks

This function is only supported for asymmetric keys.

Requirements

Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]

End of client support

Windows XP

End of server support

Windows Server 2003

Header

Wincrypt.h

DLL

Crypt32.dll

See also

CryptAcquireContext
CryptExportPKCS8
CryptImportPKCS8
CRYPT_PKCS8_EXPORT_PARAMS

 

 

Community-inhoud

Toevoegen
Weergeven:
© 2014 Microsoft