CRYPT_PKCS8_EXPORT_PARAMS structure (wincrypt.h)

[The CRYPT_PKCS8_EXPORT_PARAMS structure is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.]

The CRYPT_PKCS8_EXPORT_PARAMS structure identifies the private key and a callback function to encrypt the private key. CRYPT_PKCS8_EXPORT_PARAMS is used as a parameter to the
CryptExportPKCS8Ex function, which exports a private key in PKCS #8 format.

Syntax

typedef struct _CRYPT_PKCS8_EXPORT_PARAMS {
  HCRYPTPROV                      hCryptProv;
  DWORD                           dwKeySpec;
  LPSTR                           pszPrivateKeyObjId;
  PCRYPT_ENCRYPT_PRIVATE_KEY_FUNC pEncryptPrivateKeyFunc;
  LPVOID                          pVoidEncryptFunc;
} CRYPT_PKCS8_EXPORT_PARAMS, *PCRYPT_PKCS8_EXPORT_PARAMS;

Members

hCryptProv

An HCRYPTPROV variable that contains a handle to the cryptographic service provider (CSP) used to encrypt the private key. This is a handle to the CSP obtained by calling CryptAcquireContext.

dwKeySpec

A DWORD variable that contains the key specification. The following dwKeySpec values are defined for the default provider.

Value Meaning
AT_KEYEXCHANGE
Keys used to encrypt/decrypt session keys.
AT_SIGNATURE
Keys used to create and verify digital signatures.

pszPrivateKeyObjId

An LPSTR variable that contains the object identifier (OID) of the private key to be exported.

pEncryptPrivateKeyFunc

A PCRYPT_ENCRYPT_PRIVATE_KEY_FUNC pointer that points to a callback to a function that encrypts the private key. If this is NULL, the private key is not encrypted, and a PKCS #8 CRYPT_ENCRYPTED_PRIVATE_KEY_INFO structure will not be generated by CryptExportPKCS8Ex.

pVoidEncryptFunc

A LPVOID value that provides data used for encryption, such as key, initialization vector, and password.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Header wincrypt.h

See also

CRYPT_ENCRYPTED_PRIVATE_KEY_INFO

CryptAcquireContext

CryptExportPKCS8Ex

PCRYPT_ENCRYPT_PRIVATE_KEY_FUNC