Click or drag to resize
MimeKit

ImapClientSslKeyExchangeAlgorithm Property

Get the negotiated SSL or TLS key exchange algorithm.

Namespace:  MailKit.Net.Imap
Assembly:  MailKit (in MailKit.dll) Version: 3.0.0
Syntax
C#
public override ExchangeAlgorithmType? SslKeyExchangeAlgorithm { get; }

Property Value

Type: NullableExchangeAlgorithmType
The negotiated SSL or TLS key exchange algorithm.

Implements

IMailServiceSslKeyExchangeAlgorithm
IMailServiceSslKeyExchangeAlgorithm
Remarks
Gets the negotiated SSL or TLS key exchange algorithm once an SSL or TLS connection has been made.
Examples
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 Algorithm: {client.SslCipherAlgorithm}");
        Console.WriteLine ($"         Cipher Strength: {client.SslCipherStrength}");
        Console.WriteLine ($"          Hash Algorithm: {client.SslHashAlgorithm}");
        Console.WriteLine ($"           Hash Strength: {client.SslHashStrength}");
        Console.WriteLine ($"  Key-Exchange Algorithm: {client.SslKeyExchangeAlgorithm}");
        Console.WriteLine ($"   Key-Exchange Strength: {client.SslKeyExchangeStrength}");

        // Example Log:
        // 
        // Negotiated the following SSL options with imap.gmail.com:
        //         Protocol Version: Tls12
        //         Cipher Algorithm: Aes128
        //          Cipher Strength: 128
        //           Hash Algorithm: Sha256
        //            Hash Strength: 0
        //   Key-Exchange Algorithm: 44550
        //    Key-Exchange Strength: 255

        client.Disconnect (true);
    }
}
See Also