Naughter Software Logo

CSelectCertificateDlg v1.05 A certificate selection dialog class

Recently I've been doing quite a bit of work with SSL communications and the Windows Cryptography API in general. In one project I needed to present a dialog which allowed the end user to specify a certificate to use which was stored in one of the Certificate stores which Windows uses for persistence. To obtain the functionality I wanted, I ended up writing code which GetProcAddress'ed for 3 Windows Crypto API's namely "CryptUIDlgSelectCertificateFromStore" (which is only available on XP or 2003), "CertSelectCertificate" (which is available on Windows 2000 but which seems to be deprecated) and finally "CryptUIDlgSelectCertificateFromStore" (which also requires XP or 2003). Because the code would potentially be running on Windows 2000, I had to fall back on "CertSelectCertificate" as a last resort. This function unfortunately does not provide a way to customize which certificates are initially shown selected. I also tried getting the selection mechanism to work correctly using the pFilterCallback member of the structure you pass to "CryptUIDlgSelectCertificate" but it did not seem to work and ignored what settings I had passed to it. As time was tight with the project and there seemed to be very little samples for this area of the CryptoAPI, I decided to put up with the limitations of all the built in dialogs and vowed that I would revisit this area when I got time.


Thus was born this class which addresses all my perceived limitations of these built in dialogs. Here's what the dialog looks like when compiled with Commctrl v6 manifest support on XP, running on a computer which has had a number of certificates installed by the product "WMWare Server":


Sample screen capture of CSelectCertificateDlg


The enclosed zip file contains the source and a sample dialog based appwizard generated application to show how to use it.







v1.0 (27 August 2006)

v1.01 (5 July 2007)

v1.02 (28 December 2008)

v1.03 (3 November 2012)

v1.04 (18 January 2015)

v1.05 (19 November 2015)