简体   繁体   中英

How to Bypassing the certificate validation for tibco EMS .NET API

I am trying to connect with tibco server using ssl (ssl://host:port) but we required to bypass certificate verification.

In Java There are one API available such as

System.setProperty(BaseClient.TIBCO_STATSVCS_SSL_ALLOW_ANY_CERTIFICATE, "true");

We required same functionality in.Net API.

try this

System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };

Edit: By changing the ServerCertificateValidationCallback you change the logic with which certificate are accepted (return true) or not (return false) This code simply skips the certificates validation: any certificate will be accepted

You can of course add more logic.

You need to create your own handler, which is a method with the same inputs/output as the delegate definition:

public delegate bool RemoteCertificateValidationCallback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors);

So, for example:

 public static bool MyCertificateValidationCallback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) {
   //whatever
 }
 public static void Main() {
     System.Net.ServicePointManager.ServerCertificateValidationCallback = MyCertificateValidationCallback;
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM