Is there a way to set up an OpenSSL context (SSL_CTX
) with a reasonable set of trusted CA certificates without distributing them myself? I don't want the responsibility of keeping them up to date. IMO any modern operating system should provide "get me the trusted CA certs" as a service, but I don't know if that's actually the case.
I don't mind writing this code three times (once for Windows, once for Mac OS X, and once for Linux), but I'd prefer to cap it at that. In particular, I'd rather not try to write code that snoops around looking for what browsers are installed and trying to extract their trusted certificates. (Apparently it's easy to get this very wrong.)
The answer for recent versions of Linux seems to be to call SSL_CTX_load_verify_locations
with /etc/ssl/certs/ca-certificates.crt
(if that file exists).
Are there simple answers for Windows and Mac OS X?