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:

Did you know?Explore Trending and Topic pages for more stories like this.
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

PHP Surveys
I really would like some advice.

If you have a client come to you asking for a survey to be d

Insert numbers from Barcode scanner into online php page
I have a real big problem, Here is what I'm trying to do. I have a Intermec CN3 handheld computer th

session checking in page load
hai all I have a web site is www.Mryas.com in this my login page is Page1.aspx its co

How to know if online site made with PHP
Hello,
I see some sites that does not display extensions at all , for example:

www.site.co

Strange cookie problem. setcookie dependant on where user was directed from?
Hello,

I have a website that sets a cookie when a user visits the website. The cookie holds a

Line break?
Hi, I'm new to the forum and new to php. I'm not sure if I'm using the correct terminology so here i

Entering Data Problem
Code: $result = mysql_query("SELECT * FROM flights");
while ($row = mysql_fetch_array($

Display error above the login forum help!
Hi guys. just so you know im not asking for someone to do this for me I just need to be pointed in t

Multiple websites question.
Hi, does php have any functionality that enables a programmer to extract information from a website

Filtering for a phrase using pregmatch
Here is my code which looks for addresses which start with ' src=" '

Code: [Select]preg_

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