krijnsent / crypto_vba

An Excel/VBA project to communicate with various cryptocurrency exchanges APIs
MIT License
155 stars 54 forks source link

Poloniex API - POST #25

Closed theMoe closed 6 years ago

theMoe commented 6 years ago

Hi, Excel shows me always a runtime error the channel is not secured if I try to use the Poloniex API. Any ideas?

krijnsent commented 6 years ago

I just ran the tests again, works fine for me. Could you add some debug.print commands in the PrivatePoloniex module and post those, so I can maybe see what is happening?

theMoe commented 6 years ago

I sent you an email with screenshots.

Ezoptron commented 6 years ago

Hello, I have the same error in Excel 2010. It appeared maybe a month ago. The macro was working correctly before, but now it doesn`t work. It stops on string "objHTTP.Send (postdata)" in PrivatePoloniex with error of supporting security channels.

krijnsent commented 6 years ago

It could be a windows update, I found this:

https://stackoverflow.com/questions/44045305/vba-an-error-occurred-in-the-secure-channel-support

which points to e.g.

https://stackoverflow.com/questions/35089900/winhttp-winhttprequest-5-1-does-not-work-with-paypal-sandbox-after-tls-1-2

It says that you can try to add httpRequest.option (9) = 128

Would that or any of the other solutions work? My PC passes the tests, so I have a hard time testing your problem.

theMoe commented 6 years ago

I tried the option and installed the easy fix, but I still get the same error.

kapamucm commented 6 years ago

I have the same problem.

krijnsent commented 6 years ago

Hi all, I probably need some help here, as I can't reproduce this error. What I did find: -various options that can be added to a HTTPrequest: https://msdn.microsoft.com/en-us/library/windows/desktop/aa384108(v=vs.85).aspx (that list are all the options, the first is 0, second 1, etc. Nr 9 (the first suspect for this error) is WinHttpRequestOption_SecureProtocols ) -So try adding some option, like 9: hreq.Option(9) = 512 '512 = TLS 1.1, 2048 for TLS 1.2 -Or option 4 (WinHttpRequestOption_SslErrorIgnoreFlags) req.Option(4) = 13056

If you find a solution that works, please post it here. If the problem persists, please post your Windows version & Office version as that might help finding a solution.

krijnsent commented 6 years ago

Just checked: Poloniex only seems to support TLS 1.0 and 1.2 ( https://www.ssllabs.com/ssltest/analyze.html?d=poloniex.com&s=104.20.12.48 ), not TLS 1.1, so please check option 9 with value 2048 -> if that option gives an error it means you'd need to run a Windows update to make TLS 1.2 possible.

This guy solved his VBA "secure channel" issue: https://www.linkedin.com/pulse/working-vba-tls-protocol-srinath-gudimetla/

theMoe commented 6 years ago

I used .Option(4) = 13056 and it works :+1: Option(9) didn'twork with the numbers 512, 2048.

@krijnsent Thanks for your help!

I use Windows 7 SP1 and Office 2013.

Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
objHTTP.Option(4) = 13056
objHTTP.Open "POST", Url, False
krijnsent commented 6 years ago

Added the option(4) code to the module, feel free to close this issue if it works @Ezoptron @kapamucm

kapamucm commented 6 years ago

yes, it works. Thank you very much to everybody!

Ezoptron commented 6 years ago

It`s not works. I use Win 7 SP1 and Office 2010.