CryptUIDlgSelectCertificate function

The CryptUIDlgSelectCertificate function displays a dialog box that allows a user to select a certificate.


PCCERT_CONTEXT WINAPI CryptUIDlgSelectCertificate(


pcsc [in]

A pointer to a CRYPTUI_SELECTCERTIFICATE_STRUCT structure that contains information about the dialog box to display.

Return value

A pointer to a CERT_CONTEXT structure that represents the certificate selected by the user. When you have finished using this certificate, you must pass this pointer to the CertFreeCertificateContext function to decrement the reference count of the certificate context.

If the dwFlags member of the pcsc structure does not contain the CRYPTUI_SELECTCERT_MULTISELECT flag, a return value of NULL means that the user closed the dialog box without selecting a certificate.

If the dwFlags member of the pcsc structure does contain the CRYPTUI_SELECTCERT_MULTISELECT flag, this function always returns NULL. The selected certificates will be contained in the certificate store that is represented by the hSelectedCertStore member of pcsc. If the number of certificates in the store is the same before and after calling CryptUIDlgSelectCertificate, the user closed the dialog box without selecting any certificates.


If the dwFlags member of the CRYPTUI_SELECTCERTIFICATE_STRUCT structure is set to CRYPTUI_SELECTCERT_LEGACY, the legacy dialog is displayed. Otherwise, the current certificate selection dialog is displayed.


Minimum supported client

Windows XP [desktop apps only]

Minimum supported server

Windows Server 2003 [desktop apps only]





Unicode and ANSI names

CryptUIDlgSelectCertificateW (Unicode) and CryptUIDlgSelectCertificateA (ANSI)

See also