Jump to content

Recommended Posts

Posted

Greetings,

I want use WinHttpRequest to access a OpenShift API server, it use a self signed certificate.

Does now work...

I never try with a self signed certificate, how do this?

Best regards

Global $oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("GET", "https://openshift.domain:1234/api/", False)
$oHttp.Option(4) = 0x0100  + 0x0200 + 0x1000 + 0x2000
$oHTTP.Option(9) = 0x0080 ;WinHttpRequestOption_SecureProtocols
;~  $oHttp.SetClientCertificate("LOCAL_MACHINE\\Personal\\certificado.crt")
$oHttp.Send()

$oHttp.WaitForResponse()

Local $oAllHeaders = $oHttp.GetAllResponseHeaders()
$oReceived = $oHttp.ResponseText
$oStatusCode = $oHttp.Status
$oHttp = 0
If $oStatusCode = 200 Then
    ConsoleWrite("$oAllHeaders--------------------" & @LF & $oAllHeaders & "$oAllHeaders--------------------" & @LF)
Else
    ConsoleWrite("< error = " & $oReceived & @LF & $oAllHeaders & @LF)
EndIf

 

Visit my repository

Posted

I found the problem.

I use Windows Vista to develop this script, and it does not have TLS 1.2 protocol.

The OpenShift use TLS 1.2 in your certificate, so... always break in:

$oHttp.Option($WinHttpRequestOption_SecureProtocols) = 0x800

0x800 is TLS1.2, Windows Vista does not have.

The update is from Windows 7 for WinHttpRequest.

https://support.microsoft.com/pt-br/help/3140245/update-to-enable-tls-1-1-and-tls-1-2-as-a-default-secure-protocols-in

Someone know a way to update WinHttp to TLS 1.2 on Windows Vista?

Visit my repository

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...