CryptImportPublicKeyInfoEx (Windows CE 5.0)
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(HCRYPTPROVhCryptProv,DWORDdwCertEncodingType,PCERT_PUBLIC_KEY_INFOpInfo,ALG_IDaiKeyAlg,DWORDdwFlags,void* pvAuxInfo,HCRYPTKEY* phKey);
Parameters
hCryptProv
[in] Handle to 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.The pzObjId member of the structure 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 set to zero.pvAuxInfo
[in] Reserved for future use and must be set to NULL.phKey
[out] Pointer to the handle to the imported public key.
Return Values
If the function succeeds, the return value is nonzero, or TRUE.
If the function fails, the return value is zero, or FALSE.
For extended error information, call the GetLastError function.
Errors from the called CryptGetUserKey and CryptExportKey functions might be propagated to this function.
The GetLastError function can return ERROR_FILE_NOT_FOUND, which indicates that an installable or registerable import function could not be found for the specified dwCertEncodingType and pInfo parameters.
Remarks
The desktop operating system supports the flag PKCS_7_ASN_ENCODING, but Windows CE does not and ignores the flag when it is specified.
Requirements
OS Versions: Windows CE 3.0 and later.
Header: Wincrypt.h.
Link Library: Crypt32.lib.
See Also
CryptAcquireContext | CryptExportKey | CryptExportPublicKeyInfoEx | CryptGetUserKey | ALG_ID | CERT_PUBLIC_KEY_INFO
Send Feedback on this topic to the authors