EventDay / Infusionsoft.net

A C# Wrapper around the Infusionsoft.com API
15 stars 22 forks source link

TLS 1.2 #62

Open mativarini opened 6 years ago

mativarini commented 6 years ago

How can I set the security protocol to use TLS 1.2 ?

Regards

climbtherock commented 6 years ago

I am receiving an SSL/TLS abort error. From what I can see the call is being made using TLS1.0. I would also like to know how to specify the TLS version to get around this.

ward0094 commented 6 years ago

we are also seeing this issue and need a fix ASAP. Our system is currently down do to this security protocol change.

markwsanders commented 6 years ago

I was able to fix this issue by placing

System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

AFTER EACH call to Connect(). It only seemed to work if I did it after each call. Just doing an insert of the line earlier in the program did not seem to help.

Example:

var customer = new Customer(ApplicationName, ApiKey);
var client = customer.Connect();
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
return client;
joeldahlin commented 6 years ago

@markwsanders your fix worked for me. Thanks!

axyl commented 6 years ago

We didn't need to do that. It seems as if the fixes in the code had already been a few months back. As long as you're compiling for 4.5 or above.

We had been using the Nuget library to reference the binary, but that's old.

Removing that and compiling this library from source and referencing it was all we had to do.

If your projects aren't targeting 4.5 or above, then you'll likely need to do what @markwsanders is talking about above...otherwise it shouldn't be necessary.

TraGicCode commented 6 years ago

@axyl

Thanks for the information. I will definitely compile this myself since it's unfortunately an abandoned github repo and the newer versions are not on nuget.

As a side note i would recommend that if the version of .NET the application is compiled for is below 4.6 ( whichever one started using the stronger cryptography, i would instead of hardcoded the TLS version everywhere in the code, which is not recommended by microsoft and a bad idea is to simply add the following registry key to your servers to have the start using stronger cryptography protocols by default.

https://blogs.msdn.microsoft.com/friis/2017/10/09/troubleshooting-tls-ssl-scenario-2/

mativarini commented 6 years ago

I did the same as @axyl ! Get the repo in my machine, compile it and add the reference to the dll instead of the nugget package and that worked for me.

I am still wondering why...if it was becouse the nugget package was not up to date (although it sayed it was) or just that adding the dll localy, made it recognise that was on .net 4.5 and used TLS 1.2 by default

axyl commented 6 years ago

The Nuget package hasn't been updated since 2014.

@scottcate upgraded the project to 4.5 back in April.

@scottcate Do you have access to the Nuget package for this project to upgrade that too?

mativarini commented 6 years ago

That makes sense @axyl !

I forgot to check the history of the commits to confirm my doubt

We may need to change the Open state of this issue right?