With EWS got an exception explicit tls/ssl not supported, use implicit

0 votes
asked Sep 27, 2016 by dsouzac (360 points)
edited Sep 27, 2016 by Tomas Knopp

We are using IMAP for inbound emails, now adding support for EWS and POP3 with the help of Rebex library.

var client = new Ews();
client.Settings.SslAcceptAllCertificates = true;
client.Settings.SslAllowedVersions = TlsVersion.TLS10 | TlsVersion.TLS11 | TlsVersion.TLS12;
client.ValidatingCertificate += new EventHandler<SslCertificateValidationEventArgs>(ValidateCertificate);

client.Connect(myServer, 443, SslMode.Explicit);
client.Login(myUser, myPwd);

which thrown an exception as, Explicit TLS/SSL not supported, use implicit TLS/SSL instead

I am using version 1.0.6026.0 of EWS library.

am i doing wrong in my test application or shouldn't use explicit instead use implicit?

Applies to: Rebex Secure Mail

1 Answer

0 votes
answered Sep 27, 2016 by Tomas Knopp (58,580 points)

Hello,

the EWS protocol itself does not allow TLS/SSL in explicit mode.

That's why you got the exception when explicitly trying that.
To connect to EWS server with implicit TLS/SSL mode just use this code:

var client = new Ews();

// connect to a server using HTTPS protocol under implicit TLS/SSL mode:
client.Connect(myServer);
client.Login(myUser, myPwd);

Please note that accepting all server certificates via the SslAcceptAllCertificates property is definitely not meant for production code.

...