Call to SSPI Failed C#

0

enter image description hereI get this output from my output:

Connecting to 192.168.3.116:21
220 ProFTPD Server (Debian)
AUTH TLS
220 AUTH TLS Successful
Unable to connect

Exception:

2/20/2020 11:18 AM Message: A call to SSPI failed, see inner exception. InnerException: System.ComponentModel.Win32Exception (0x80004005): The client and server cannot communicate, because they do not possess a common algorithm at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult) at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result) at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at Hani.Utilities.SslClient.d__5.MoveNext() in C:\Users\Specter\Documents\PlusFTP\Utilities\SslClient.cs:line 36

Here is the cs file code:

using System;
using System.IO;
using System.Net.Security;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;

namespace Hani.Utilities
{
    static class SslClient
    {
        /*public class SampleEventArgs
        {
            public SampleEventArgs(string s)
            {
                Text = s;
            }
            public String Text { get; private set; } // readonly
        } */

        internal delegate void ValidateCertificateHandler(object sender, 
            X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors);
        internal static event ValidateCertificateHandler OnValidateCertificate;

        internal static void ValidateCertificate(object sender, X509Certificate certificate, 
            X509Chain chain, SslPolicyErrors sslPolicyErrors)
        {
            if (OnValidateCertificate != null)
                new ValidateCertificateHandler(OnValidateCertificate)
                      (sender, certificate, chain, sslPolicyErrors);
        }

        internal static async Task<SslStream> ConnectAsync(Stream s, 
                    string server, SslProtocols prot)
        {
            try
            {
                X509CertificateCollection clientCertColl = new X509CertificateCollection();
                SslStream sslStream = new SslStream(s, false, 
                    new RemoteCertificateValidationCallback(validate), null);
                await sslStream.AuthenticateAsClientAsync(server, 
                          clientCertColl, prot, false);
                return sslStream;
            }
            catch (Exception exp) { ExceptionHelper.Log(exp); }
            return null;
        }

        private static bool validate(object sender, X509Certificate certificate, 
                X509Chain chain, SslPolicyErrors sslPolicyErrors)
        {
            if (sslPolicyErrors != SslPolicyErrors.None)
            {
                ValidateCertificate(sender, certificate, chain, sslPolicyErrors);
                //InfoMsg("Certificate error: " + tmpResponsed, MessageType.Error);
            }

            return true;
        }
    }
}
c#
.net
ssl
asked on Stack Overflow Feb 20, 2020 by Student343 • edited Feb 20, 2020 by Student343

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0