POP3 and SMTP common algorithm exception with SSL (C# .NET)

Hello.
Our customer supports the following settings:
SSL Protocol: Tls12
SSL Cipher: Aes128
SSL Hash Alg: 32780

We use Aspose.Email.dll v.19.2

When we try to get e-mails using POP3 protocol we’ll receive exception like this:

AsposeException: Unable to read data from the transport connection.
—> AsposeException: Unable to read data from the transport connection.
—> Pop3Exception: Unable to read data from the transport connection.
—> System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. —> System.ComponentModel.Win32Exception: The client and server cannot communicate, because they do not possess a common algorithm
— End of inner exception stack trace —
at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
at #=zLy_I0xYBwgp7Q8XIclYbOJ35YnwnA456tw==.#=zp06H_qoxmvtw()
at #=zLy_I0xYBwgp7Q8XIclYbOJ35YnwnA456tw==.Read(Byte[] #=z6C$206s=, Int32 #=zovyy3TU=, Int32 #=zsS8mhDs=)
at #=zeVeA$xSRnHytVecZtu7pZ4iy8DvGJbsMAw==.Read(Byte[] #=z6C$206s=, Int32 #=zovyy3TU=, Int32 #=zsS8mhDs=)
at #=z7ZxCQ3M60Gvfts3rbBUW94HabXg8.#=zlp5GevY=(Byte[] #=z6C$206s=, Int32 #=zovyy3TU=, Int32 #=zsGQSp10=)
at #=z7ZxCQ3M60Gvfts3rbBUW94HabXg8.#=zlp5GevY=(Byte[] #=z6C$206s=)
at #=z8nOq84flKdQWnkPAUCHbTEQdSuHF1$ayzQ==.#=zBgory0rkg_KP(Boolean #=zkLIwX5aniLBt)
— End of inner exception stack trace —
at #=z8nOq84flKdQWnkPAUCHbTEQdSuHF1$ayzQ==.#=zBgory0rkg_KP(Boolean #=zkLIwX5aniLBt)
at #=z8nOq84flKdQWnkPAUCHbTEQdSuHF1$ayzQ==.#=z_F_RFzQ=(Object #=zHIahBRI=)
— End of inner exception stack trace —
at #=zMLW2ASVsjEO7ZruXYSpuR17y0zMv.#=zmLgYcOk=(IAsyncResult #=zNnNrAWY=)
at #=zMLW2ASVsjEO7ZruXYSpuR17y0zMv.#=zCfw$6HU=()
at #=zYJ54h52Wz82r71egNHHSYzDU54I6nrhZzcWB$QQ=.#=zsFEdfDxNAeBf(String #=zGw$rS_U=, Int32 #=zaiFRPnA=, SecurityOptions #=z8p4ZES9XYGjn)
at #=zYJ54h52Wz82r71egNHHSYzDU54I6nrhZzcWB$QQ=.#=z0DxqtgttSeso(String #=zGw$rS_U=, Int32 #=zaiFRPnA=)
— End of inner exception stack trace —
at #=zYJ54h52Wz82r71egNHHSYzDU54I6nrhZzcWB$QQ=.#=z0DxqtgttSeso(String #=zGw$rS_U=, Int32 #=zaiFRPnA=)
at #=zYJ54h52Wz82r71egNHHSYzDU54I6nrhZzcWB$QQ=.#=zhNCh0OI=()
at #=zijUlNlatNZx58k3PRf33r09hrnOsXR847w==.#=zlNRHJP13Trt5(#=zWw0l3YqMITH5vnynketUxNTaALNXXF99pw== #=zCc2HxOs=)
at #=z7ZxCQ3M60Gvfts3rbBUW94HabXg8.#=z6jMGWQA=(#=zMLW2ASVsjEO7ZruXYSpuR17y0zMv #=zx0gBBv4=)
at #=zMLW2ASVsjEO7ZruXYSpuR17y0zMv.#=zwIemAnA=(AsyncCallback #=zdZ3RyxI=, Object #=zHIahBRI=)
at #=zMLW2ASVsjEO7ZruXYSpuR17y0zMv.#=zwIemAnA=(AsyncCallback #=zdZ3RyxI=)
at #=zMLW2ASVsjEO7ZruXYSpuR17y0zMv.#=zCfw$6HU=()
at #=zbBigaA7T73lWVhh3fTr2fkmwh18aTHQtBA==.#=zu8jIzgk=(#=zWw0l3YqMITH5vnynketUxNTaALNXXF99pw== #=zLjFsPyg=)
at #=zBSg$3i7BHZnFkYVa$zg3Mqje1I_3.#=zNuL3mwM=(Int32 #=zcifhP6I=, #=zWw0l3YqMITH5vnynketUxNTaALNXXF99pw== #=zLjFsPyg=)
at #=zMLW2ASVsjEO7ZruXYSpuR17y0zMv.#=zW30Pv748fxxd()
at #=zMLW2ASVsjEO7ZruXYSpuR17y0zMv.#=zwIemAnA=(AsyncCallback #=zdZ3RyxI=, Object #=zHIahBRI=)
at Aspose.Email.Clients.Pop3.Pop3Client.BeginGetMessageCount(IConnection connection, Boolean closeTransaction, AsyncCallback callback, Object state)
at Aspose.Email.Clients.Pop3.Pop3Client.GetMessageCount()
at Emc.InputAccel.Import.Email.Program.TryToUsePop3AsposeEmail(String host, String user, String psw, Boolean useDefCred)

SMTP protocol doesn’t work with the same exception.

When I use other libraries like Net.Tcp or MailKit.Email I have no such problem.
Could you please clarify what’s the reason? How can I change or use other algorithm?

Thank you.

@cap.aspose,

I have observed the stack trace shared by you and request you to please provide the sample application along with account that we may try on our end to verify and help you further.

Hi.
I use this code to receive e-mails:

        var pop3ClientConnection = new Pop3Client();
        var msgCount = 0;
        try {
            pop3ClientConnection.Host = host;
            pop3ClientConnection.Port = 995;
            pop3ClientConnection.Username = user;
            pop3ClientConnection.Password = psw;
            pop3ClientConnection.SecurityOptions = SecurityOptions.SSLAuto;

            msgCount = pop3ClientConnection.GetMessageCount();
        }
        catch (Exception e)
        {
            return "We have a problem..  " + e;
        }
        finally
        {
            // free up space
            pop3ClientConnection.Dispose();
        }

@cap.aspose,

Thank you for sharing the code. Can you please provide information that which POP server you are using on your end along with a test user account that we may try on our end to verify the issue on our end.

Hello.
This is a private exchange server which supports the settings I provide above.

@cap.aspose,

I have tried accessing my test Gmail account using Pop3 and there has been no issue incurred on my end with your code. I don’t find any issue while using Pop3 on my end.

    public static void TestPop3()
    {
        var pop3ClientConnection = new Pop3Client();
        var msgCount = 0;
        try
        {
            string user = "test3@gmail.com";
            string psw = "pass";

            String host = "pop.gmail.com";
            pop3ClientConnection.Host = host;
            pop3ClientConnection.Port = 995;
            pop3ClientConnection.Username = user;
            pop3ClientConnection.Password = psw;
            pop3ClientConnection.SecurityOptions = SecurityOptions.SSLAuto;
         //   pop3ClientConnection.SecurityOptions = SecurityOptions.Auto;
            msgCount = pop3ClientConnection.GetMessageCount();
            int ss = 0;
        }
        catch (Exception e)
        {
            String s= "We have a problem..  " + e;
        }
        finally
        {
            // free up space
            pop3ClientConnection.Dispose();
        }

    }

Well.
Could you please clarify what SSL Hash Algorithm does Aspose.Email prefer?

@cap.aspose,

Aspose.Email Clients supports Ssl2, Ssl3, Tls, Tls11, Tls12 protocols. However, it depends on .NET Framework which is on your end. Actually, Tls12 is not setup by default. So, if you need Tls12 you have to set it like in following code snippet:

client.SupportedEncryption = EncryptionProtocols.Tls12;

Moreover, the server also has to support used protocol. SecurityOptions is SSLImplicit or Auto or SSLAuto by default is used by following EncryptionProtocols.

EncryptionProtocols.Ssl2 | // Most compatible set of options
EncryptionProtocols.Ssl3 | // This options set is compatible with .NET Framework since 2.0; .NET Core since 1.0; .NET Standard since 1.3
EncryptionProtocols.Tls; // If user needs other settings he may set his own set of options in CredentialsByHostClient.SupportedEncryption

Aspose.Email use TLS/SSL stream implemented in .NET classes. Implementation of this class depends on installed .NET Framework. If client has version of .NET Framework, which supports TLS 1.2 with algorithm AES128, this means that our library also supports TLS 1.2 with algorithm AES128. In order to enable it, one has to write following code

client.SupportedEncryption = EncryptionProtocols.Tls12;

Hello.
The point is Aspose.Email library throw exception when we don’t set TSL 1.2 manually and trying to use system settings from registry.
When we set explicitly only TLS 1.2 protocol like show below it works fine.

But Microsoft recommend do not specify the TLS version manually.
So how can we work with TLS 1.2 version only using registry settings?
Does Aspose.Email work with System.Default settings?
Other third-party library, like Microsoft’s Net.Tcp or MailKit.Email work fine with default system settings.
Could you clarify that.

Thank you

@cap.aspose,

We have observed the information shared by you and an issue with ID EMAILNET-39466 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will fixed.

Hi Team,

Do you have any updates?

Thank you

@cap.aspose,

I have verified from our issue tracking system and like to share that the issue has been marked as resolved in upcoming Aspose.Email for .NET 19.5. We will share the good news with you as soon as the issue will be fixed.

The issues you have found earlier (filed as EMAILNET-39466) have been fixed in this update.

Log in to your Gmail account through a web browser and enable access through less secure apps . Less secure apps can make your account more vulnerable, Google will automatically turn this setting off if it’s not being used. However, bypass this security setting with a configuration tweak within your Google Email Account .

How “more secure apps” help to protect your account?

Which level of access you’re giving the client before you connect your Account.
Client access only a relevant part of your Account, like your email or calendar.
Connect your Google Account to the client without exposing your password.
Disconnect your Google Account from the client at any time.

@irvinborder,

I have observed your inquiry and like to know what issue you are facing on your end and how Aspose.Email can be helpful in addressing that. As far as I can observe the observations that you have shared a related to your account and have no relation with Aspose.Email API.