Сбой вызова SSPI C# - PullRequest
       0

Сбой вызова SSPI C#

0 голосов
/ 20 февраля 2020

enter image description here Я получаю этот вывод из моего вывода:

Подключение к 192.168.3.116:21
220 ProFTPD Server (Debian)
AUTH TLS
220 AUTH TLS Успешно
Невозможно подключиться

Исключение:

2/20/2020 11:18 Сообщение: вызов Ошибка SSPI, см. Внутреннее исключение. InnerException: System.ComponentModel.Win32Exception (0x80004005): клиент и сервер не могут обмениваться данными, поскольку они не обладают общим алгоритмом в System. Net .Security.SslState.InternalEndProcessAuthentication (LazyAsyncResult lazyResult) в System. * 1027. Свойство System.Runtime.ExceptionServices. () в C: \ Users \ Spectre \ Documents \ PlusFTP \ Utilities \ SslClient.cs: строка 36

Вот код файла cs:

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;
        }
    }
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...