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

Saving data from a form into a file
Hey everybody,

Sorry, I am really new to PHP coding and such but a project kind of got thrust

shoping cart issues
i´ve wrote this and works when i add an item to, my cart, but when i want to add othrer item just

Basic Question Regarding PHP Includes
Hi

Just starting out with PHP.

Working on a site that uses some basic includes, these

Image resize
Hi again fellers

I managed to sort out the issues with the folder,

Final hurdle is th

Problems with adding a link to one position in a 'foreach' loop, please help
Hello!

Iam pretty new to programming and I wanna create a table with users from an array. It

Remove values in array2 from array1
I have two arrays.

Array 1 is where the array key holds various different numbers. For exampl

Curly Bracket Delimeters.
I'd always believed that the starting and ending delimeters in preg_ functions had to be the same ch

Multiple Dropdown Selections
I have a form that let's a user insert a page with the ability to select categories. I want them to

question about header() security
is is safe to just use the header() function to redirect someone if they are, say, not logged in? or

CODE NOT WORKING
Code: [Select]<?php
//include shared codes

include '../lib/common.php';
include

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