During a SSL/TLS handshake, I would like to have my C application search the Windows certificate store for a trusted certificate that will validate the server's certificate. Currently, the application requires a file containing the root certificate and I would like to allow it to simply use any certificate in the Windows certificate store without having to specify which one to use first, similar to the way browsers work.
I am using OpenSSL but I can't figure out how to co-ordinate the OpenSSL calls with the Windows Crypto API calls to validate the certificate.