WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.



Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Require Certificate for HTTPS Downloads


I am using Winbatch to automate file downloads from https websites. The program works great until a site is reached requiring a certificate.

Manually through IE6 the process works, (only one certificate is installed and I have the trusted root certificate for the company installed). The website is also configured as a trusted site.

I have tried using the various options under the iHttpInit with respect to certificates to no avail. I still receive the WinInet 12044 error.

Example code:

Any thoughts as to how I can assign an existing certificate to be used with the Winbatch?

In short, it appears winbatch will work when an HTTPS does not require a certificate (ie. automating the process) but when it does require the certificate the 12044 WinInet error comes up.


Here is some OLE code that allows you to specify a certificate.
;   I was able to download pages from the winbatch site using winbatch and HTTP via OLE...

;   HTTPS looks about the same and you can set the Client Cert in it...

;Example Code
;The following example shows how to select a client certificate to send with a request. 
;A certificate with the subject "My Middle-Tier Certificate" is chosen from the "Personal" 
;certificate store in the registry under 

;  is your certificate in the same place in the registry as below ??? ...

WinHttpReq = objectopen("WinHttp.WinHttpRequest.5")
WinHttpReq.SetCredentials("user", "password", "")
WinHttpReq.Open("GET", "", @false)
WinHttpReq.SetClientCertificate("LOCAL_MACHINE\Personal\My Middle-Tier Certificate") ;<---

message("Debug", WinHttpReq.ResponseText)

oh = fileopen("C:\Test\winbatch.html", "write")
filewrite(oh, WinHttpReq.ResponseText)

message("Debug", "All Done")


; actual VB Code...

;Dim HttpReq As Object
;    ' Instantiate the WinHTTPRequest ActiveX Object.
;    Set HttpReq = New WinHttpRequest
;    ' Open an HTTP connection.
;    HttpReq.Open "GET", "", False
;    'Select a client certificate.
;    HttpReq.SetClientCertificate "LOCAL_MACHINE\Personal\My Middle-Tier Certificate"
;    ' Send the HTTP Request.
;    HttpReq.Send
Note: There has been some work being done in this area of the WinInet Extender. Hopefully in the next release of the extender we will offer a function which will allow you to prompt the user for a certificate.

Note: Starting in version 25070 - Added new function iErrorDialog(handle, error) Displays a dialog box for the error that is passed to InternetErrorDlg, if an appropriate dialog box exists. In the case of ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED error it will prompt the user to choose a certificate.

For More information about this issue read:

Article ID:   W15875
File Created: 2017:07:28:13:58:48
Last Updated: 2004:03:30:15:41:19