ImapClientSslProtocol Property

Get the negotiated SSL or TLS protocol version.

Definition

Namespace: MailKit.Net.Imap
Assembly: MailKit (in MailKit.dll) Version: 5.0.0
C#
public override SslProtocols SslProtocol { get; }

Property Value

SslProtocols
The negotiated SSL or TLS protocol version.

Implements

IMailServiceSslProtocol
IMailServiceSslProtocol

Remarks

Gets the negotiated SSL or TLS protocol version once an SSL or TLS connection has been made.

Example

C#
                    public static void PrintSslConnectionInfo (string host, int port)
{
    using (var client = new ImapClient ()) {
        client.Connect (host, port, SecureSocketOptions.Auto);

        Console.WriteLine ($"Negotiated the following SSL options with {host}:");
        Console.WriteLine ($"        Protocol Version: {client.SslProtocol}");
        Console.WriteLine ($"            Cipher Suite: {client.SslCipherSuite}");

        // Example Log:
        //
        // Negotiated the following SSL options with imap.gmail.com:
        //         Protocol Version: Tls12
        //             Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256

        client.Disconnect (true);
    }
}
                  

See Also