Fix server certificate validation

This commit is contained in:
2025-09-28 18:35:40 +09:00
parent 4239dce5e1
commit 8b91197ca1

View File

@ -5,6 +5,7 @@ using System.Security.Cryptography.X509Certificates;
using System.ServiceModel; using System.ServiceModel;
using System.ServiceModel.Channels; using System.ServiceModel.Channels;
using System.ServiceModel.Description; using System.ServiceModel.Description;
using System.ServiceModel.Security;
using System.Text; using System.Text;
namespace Hcs.Broker.Api.Request namespace Hcs.Broker.Api.Request
@ -268,10 +269,11 @@ namespace Hcs.Broker.Api.Request
clientCredentials.UserName.Password = Constants.PASSWORD_SIT; clientCredentials.UserName.Password = Constants.PASSWORD_SIT;
} }
System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate ( clientCredentials.ServiceCertificate.SslCertificateAuthentication =
object sender, X509Certificate serverCertificate, X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors) new X509ServiceCertificateAuthentication()
{ {
return true; CertificateValidationMode = X509CertificateValidationMode.None,
RevocationMode = X509RevocationMode.NoCheck
}; };
if (!client.UseTunnel) if (!client.UseTunnel)