Skip to content

Commit

Permalink
Fixes .net4.6~.net4.71 framework support issue for ssl protocol setting
Browse files Browse the repository at this point in the history
  • Loading branch information
Ersan Bozduman authored and ebozduman committed Jul 2, 2023
1 parent 827e2d3 commit 3db8d8b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Minio/Credentials/CertificateIdentityProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Net;
using System.Web;
using System.Xml;
using System.Xml.Serialization;
Expand Down Expand Up @@ -154,11 +155,13 @@ public CertificateIdentityProvider Build()
builder.Query = query.ToString();
PostEndpoint = builder.ToString();

var handler = new HttpClientHandler
{
ClientCertificateOptions = ClientCertificateOption.Manual,
SslProtocols = SslProtocols.Tls12
};
var handler = new HttpClientHandler();
handler.ClientCertificateOptions = ClientCertificateOption.Manual;
#if (NET472_OR_GREATER || NET6_0_OR_GREATER)
handler.SslProtocols = SslProtocols.Tls12;
#else
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11;
#endif
handler.ClientCertificates.Add(ClientCertificate);
HttpClient ??= new HttpClient(handler)
{
Expand Down

0 comments on commit 3db8d8b

Please sign in to comment.