Export (0) Print
Expand All
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CryptExportPublicKeyInfoEx

Windows CE 3.0

This function exports the public key information associated with the provider's corresponding private key. This function allows the application to specify the public key algorithm, overriding the default provided by the cryptographic service provider (CSP).

BOOL WINAPI CryptExportPublicKeyInfoEx(
HCRYPTPROV hCryptProv,
DWORD dwKeySpec,
DWORD dwCertEncodingType,
LPSTR pszPublicKeyObjId,
DWORD dwFlags,
void *pvAuxInfo,
PCERT_PUBLIC_KEY_INFO pInfo,
DWORD *pcbInfo
);

Parameters

hCryptProv
[in] Handle of the CSP to use when exporting the public key information. This handle must have already been created using the CryptAcquireContext function.
dwKeySpec
[in] Identifies the private key to use from the provider's container. It can be AT_KEYEXCHANGE or AT_SIGNATURE.
dwCertEncodingType
[in] Specifies the encoding type used. Currently, only X509_ASN_ENCODING is used; however, additional encoding types may be added in the future.
pszPublicKeyObjId
[in] Specifies the public key algorithm.
Note   The pszPublicKeyObjId and dwCertEncodingType parameters are used together in determining the installable CRYPT_OID_EXPORT_PUBLIC_KEY_INFO_FUNC to call. If an installable function was not found for the pszPublicKeyObjId parameter, an attempt is made to export the key as an RSA Public Key (szOID_RSA_RSA).
dwFlags
[in] Reserved for future use and must be zero.
pvAuxInfo
[in] Reserved for future use and must be NULL.
pInfo
[out] Pointer to a CERT_PUBLIC_KEY_INFO structure to receive the public key information to be exported.

This parameter can be NULL to set the size of this information for memory allocation purposes.

pcbInfo
[in/out] Pointer to a DWORD that contains the size, in bytes, of the buffer pointed to by the pInfo parameter. When the function returns, the DWORD contains the number of bytes stored in the buffer.
Note   When processing the data returned in the buffer, applications need to use the actual size of the data returned. The actual size can be slightly smaller than the size of the buffer specified on input. (On input, buffer sizes are usually specified large enough to ensure that the largest possible output data will fit in the buffer.) On output, the variable pointed to by this parameter is updated to reflect the actual size of the data copied to the buffer.

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 can be propagated to this function.

The following table lists the error codes for this function.

Error code Description
ERROR_FILE_NOT_FOUND An installable or registerable export function could not be found for the specified dwCertEncodingType and pszPublicKeyObjId parameters.
ERROR_MORE_DATA If the buffer specified by the pInfo 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 pcbInfo parameter.

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, CryptGetUserKey, CryptImportPublicKeyInfoEx, CERT_PUBLIC_KEY_INFO


 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.

Show:
© 2014 Microsoft