#ifdef WIN32
else if (options->cryptoapi_cert)
{
- /* Load Certificate and Private Key */
- if (!SSL_CTX_use_CryptoAPI_certificate (ctx, options->cryptoapi_cert))
- msg (M_SSLERR, "Cannot load certificate \"%s\" from Microsoft Certificate Store",
- options->cryptoapi_cert);
+ tls_ctx_load_cryptoapi(new_ctx, options->cryptoapi_cert);
}
- else
#endif
+ else
{
X509 *my_cert = NULL;
bool pkcs11_id_management, const char *pkcs11_id);
#endif /* ENABLE_PKCS11 */
+/**
+ * Use Windows cryptoapi for key and cert, and add to library-specific TLS
+ * context.
+ *
+ * @param ctx TLS context to use
+ * @param crypto_api_cert String representing the certificate to load.
+ */
+#ifdef WIN32
+void tls_ctx_load_cryptoapi(struct tls_root_ctx *ctx, const char *cryptoapi_cert);
+#endif /* WIN32 */
+
/**
* Show the TLS ciphers that are available for us to use in the OpenSSL
* library.
}
#endif /* ENABLE_PKCS11 */
+#ifdef WIN32
+void
+tls_ctx_load_cryptoapi(struct tls_root_ctx *ctx, const char *cryptoapi_cert)
+{
+ ASSERT(NULL != ctx);
+
+ /* Load Certificate and Private Key */
+ if (!SSL_CTX_use_CryptoAPI_certificate (ctx->ctx, cryptoapi_cert))
+ msg (M_SSLERR, "Cannot load certificate \"%s\" from Microsoft Certificate Store",
+ options->cryptoapi_cert);
+}
+#endif /* WIN32 */
+
void
show_available_tls_ciphers ()
{