PCRYPT_DECRYPT_PRIVATE_KEY_FUNC callback function

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

The PCRYPT_DECRYPT_PRIVATE_KEY_FUNC function decrypts the private key and returns the decrypted key in the pbClearTextKey parameter. PCRYPT_DECRYPT_PRIVATE_KEY_FUNC is a callback function specified in a CRYPT_PKCS8_IMPORT_PARAMS structure. It is used when a CRYPT_ENCRYPTED_PRIVATE_KEY_INFO structure contains a private key that needs to be decrypted. The CryptImportPKCS8 function uses this function. The function must be implemented by the developer to suit each application.

Syntax

PCRYPT_DECRYPT_PRIVATE_KEY_FUNC PcryptDecryptPrivateKeyFunc;

BOOL PcryptDecryptPrivateKeyFunc(
  CRYPT_ALGORITHM_IDENTIFIER Algorithm,
  CRYPT_DATA_BLOB EncryptedPrivateKey,
  BYTE *pbClearTextKey,
  DWORD *pcbClearTextKey,
  LPVOID pVoidDecryptFunc
)
{...}

Parameters

Algorithm

A CRYPT_ALGORITHM_IDENTIFIER structure that identifies the algorithm used to encrypt the PrivateKeyInfo ASN.1 type found in the PKCS #8 standard.

EncryptedPrivateKey

A CRYPT_DATA_BLOB value that identifies the encrypted private key BLOB.

pbClearTextKey

pcbClearTextKey

pVoidDecryptFunc

An LPVOID value that provides data used in decryption, such as key, initialization vector, and password.

Return value

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

If the function fails, it returns zero (FALSE).

Requirements

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

See also

CRYPT_ENCRYPTED_PRIVATE_KEY_INFO

CRYPT_PKCS8_IMPORT_PARAMS

CryptImportPKCS8