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

phpMailer will not connect using SMTP
I am trying to use phpMailer with smtp:

Code: [Select]$mailer = new PHPMailer();
$mailer-&

Add trigger to UpdatePanel programmatically
Hi,I'm working on a website which uses AJAX and Masterpages. What I have is an AJAX UpdatePanel whi

disabling a button server-side then re-enabling client-side breaks button postback
I have a tabbed container and a button (not in the container) on a page. If the first tab is selecte

making web pages for accounts
Hello, I would like to make pages for accounts on my website im making (its not a real website..im j

insert Multiple rows into the table from that table data
Hi All,

I have a requirement like to insert mulitple rows into the table from that

file_put_contents and createimagefromjpeg
All,
I do somethings and then I have the following code:
file_put_contents('./test/'.$filename

Thought I has this figured out especially after all the help i received?
Cags, Salathe, Daniel helped me with this yesterday, but not sure i took it all in.
I am attempti

understanding functions and classes
Code: [Select]
class person {
var $name = "Jimmy Goe";

function get_nam

URL Rewrite issue
Im created a series of Rewrites and on page checks to make sure the correct url is being called. But

Array help
Hello i got this code to fetch data from database but it is not working it displays
7
Array

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