Newsgroups : Microsoft : microsoft.public.inetsdk.programming.wininet : 2007 Jan : [SSL] HttpSendRequest, error 12045, verifying server certificate from file
| Subject: | [SSL] HttpSendRequest, error 12045, verifying server certificate from file |
| Posted by: | "Lars Uhlmann" (usen..@lars-uhlmann.de) |
| Date: | Mon, 22 Jan 2007 21:02:00 |
I'm trying to open a SSL connection:
,-----
| hOpen = InternetOpen(
| "httpsexample",
| INTERNET_OPEN_TYPE_DIRECT,
| NULL,
| NULL,
| 0 );
|
| hConnect = InternetConnect (
| hOpen,
| "localhost",
| INTERNET_DEFAULT_HTTPS_PORT,
| "",
| "",
| INTERNET_SERVICE_HTTP,
| 0,
| 0 );
|
| hReq = HttpOpenRequest (
| hConnect,
| "GET",
| "/index.htm",
| HTTP_VERSION,
| "",
| NULL,
| INTERNET_FLAG_SECURE,
| 0 );
|
| HttpSendRequest(
| hReq,
| NULL,
| 0,
| NULL,
| 0 );
`-----
If the server certificate is imported to the appropriate certification
store via the dialog in IE everything works fine. But I don't want to
(and can't) touch the target systems certification store. Therefore the
ca cert exists as file (ca.cer, X509_ASN_ENCODING) in the applications
path. How can I verify the server certificate with this file?
I guess I have to create a temporary (memory) certification store and
import my ca cert into it. Then a have to set the type to "CA" and
"connect" the store to my 'HttpSendRequest()'. The question is how to
do it? Can anybody provide an example?
thanks in advance
Lars