I am developing a UWP C++/winRT app in Visual Studio, and am trying to get the cpp-httplib library to work. It works fine if I am not using HTTPS, but when I define the CPPHTTPLIB_OPENSSL_SUPPORT flag, an "#ifdef" in httplib.h defines a function which subcalls CertOpenSystemStoreW(), which results in an error that CertOpenSystemStoreW() is undeclared.
On tracing deeper into <wincrypt.h>, it seems that CertOpenSystemStoreW is part of an unactivated code region because of my configuration.
What can I do to reactivate the region, or what should I replace CertOpenSystemStoreW() with, to make SSL work? (CertOpenStore() seems to work, but I don't really understand SSL details enough to know if I can simply replace the function)
#include "pch.h"
#include "USDA_API.h"
#include <openssl/ssl.h>
#define CPPHTTPLIB_OPENSSL_SUPPORT
#include <httplib.h>
//#include <cpr/cpr.h>
USDA_API::USDA_API()
{
httplib::Client cli("http://www.google.com");
auto resp = cli.Get("/");
int y = 4;
}
Is there an easier way to send HTTPS requests (GET, POST, etc.) in C++/winRT that I don't know about? If C++/winRT is an extension to UWP, and UWP is invalidating CertOpenSystemStoreW() in wincrypt.h, how are people sending HTTPS requests in UWP C++ apps?
Thanks! I was able to send HTTPS responses using HttpClient. I also copy-pasted "json.hpp" into my project from a header-only json library, since Windows.Data.Json wasn't being recognized by VS for some reason.
I successfully was able to get a HTTPS response and parse the data !