CryptImportPublicKeyInfoEx

This function imports public key information into the cryptographic service provider (CSP) and returns a handle of the public key. Additional parameters to override defaults are provided to supplement those in the CERT_PUBLIC_KEY_INFO structure.

BOOL WINAPI CryptImportPublicKeyInfoEx(
HCRYPTPROV hCryptProv,
DWORD dwCertEncodingType,
PCERT_PUBLIC_KEY_INFO pInfo,
ALG_ID aiKeyAlg,
DWORD dwFlags,
void *pvAuxInfo,
HCRYPTKEY *phKey
);

Parameters

  • hCryptProv
    [in] Handle of the CSP that will receive the imported public key. This handle must have already been created using the CryptAcquireContext function.

  • dwCertEncodingType
    [in] Specifies the encoding type used. Currently, only X509_ASN_ENCODING is used; however, additional encoding types may be added in the future.

  • pInfo
    [in] Pointer to a CERT_PUBLIC_KEY_INFO structure containing the public key to import into the provider.

    Note The pzObjId member of the Algorithm member pointed to by the pInfo parameter and the dwCertEncodingType parameter determine an installable CRYPT_OID_IMPORT_PUBLIC_KEY_INFO_FUNC callback function. If an installable function is not found, an attempt is made to import the key as a szOID_RSA_RSA, RSA Public Key.

  • aiKeyAlg
    [in] ALG_ID structure containing a CSP-specific algorithm to override the CALG_RSA_KEYX default algorithm.

  • dwFlags
    [in] Reserved for future use and must be zero.

  • pvAuxInfo
    [in] Reserved for future use and must be NULL.

  • phKey
    [out] Pointer to the handle of the imported public key.

Return Values

If the function succeeds, the return value is nonzero (TRUE).

If the function fails, the return value is zero (FALSE).

For extended error information, call the GetLastError function.

Note   Errors from the called CryptGetUserKey and CryptExportKey functions might be propagated to this function. This function has the following error code.

Error code Description
ERROR_FILE_NOT_FOUND An installable or registerable import function could not be found for the specified dwCertEncodingType and pInfo parameters.

Remarks

The desktop platform supports the PKCS_7_ASN_ENCODING flag, but Windows CE does not. Windows CE ignores the flag when it is specified.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 3.0 or later Wincrypt.h   Crypt32.lib

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

CryptAcquireContext, CryptExportKey, CryptExportPublicKeyInfoEx, CryptGetUserKey, ALG_ID, CERT_PUBLIC_KEY_INFO

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.