InternetOpenUrl() Invalid cert


Posted on 16th Feb 2014 07:03 pm by admin

Hi all,

Does anyone know how to prevent calls to InternetOpenUrl() from failing with error 12045 (ERROR_INTERNET_INVALID_CA)? I have the following code below:

Code: HINTERNET IntOpen = ::InternetOpen(L"Sample", LOCAL_INTERNET_ACCESS, NULL, 0, 0); HINTERNET handle = ::InternetOpenUrl(IntOpen, L"https://192.168.1.10/file.txt", NULL, NULL, INTERNET_FLAG_IGNORE_CERT_CN_INVALID, NULL); if (handle == NULL) { cout << "Error opening URL, " << GetLastError(); return 1; } char buf[1024]; DWORD dwRead = 0; while (InternetReadFile(handle, buf, sizeof(buf), &dwRead) == TRUE) { if (dwRead == 0) break; cout << buf; } This works OK on valid sites, but since my server has a self signed certificate, it fails with error code 12045. I know the INTERNET_FLAG_IGNORE_CERT_CN_INVALID is technically looking for hostname mismatches, and not invalid CA's.

Any help would be appreicated.

Thanks,

No comments posted yet

Your Answer:

Login to answer
270 Like 36 Dislike
Previous forums Next forums
Other forums

Check before inserting in DB ???
This is my code
---------------
if ( $_POST ['Submit'])
{{
$username = $_POST ['usernm

Binding 2 UDP sockets on same port, connected to different destinations, 1 receives
Hello,
My application wants to send/recv data to 2 different UDP ports on a remote computer, us

C++ API to Oracle dB
I need to perform a select command to the Oracle dB to obtain information from a table.
What libr

Recording popularity by day, week.. all time?
Hey everyone, I'm creating a site designed around users uploading music. How can I implement a syste

php and downloading
I want to use a php script to create two files. Then I want it to redirect (or whatever) to have tho

php call servlet
I have done a php backup application .
So there is a form that user pick some files to zip and d

How to restrict the display of report variants
Hello All,

I want t know how to restrict the display of report variants.
I mean, whe

NOOB needs help with upload file
The intent of this form is to create a folder for a client and upload an image into another folder '

Hashing?
Hi, I was hoping to take a string value then convert it - consistently - across each of our pages in

ereg_replace in Wordpress
Heya - so I'm working on this site: http://world-of-smiles.theportlandco.com/new-patients

The

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash