i' m trying to support TLS with this ftp project. but facing issue. in order to handle Data socket in secure way,
i've added following code
__public static X509Certificate2 GetCertificate()
string certificate =
(serverCertificate == null )
serverCertificate = new X509Certificate2(certificate, "");
TcpListener listener = SocketHelpers.CreateTcpListener(endpoint);
TcpClient socket = listener.AcceptTcpClient();
//wrap networkstream with ssl
SslStream sslStream = new SslStream(socket.GetStream(),false);
// following line execution is too slow...
stream.AuthenticateAsServer(GetCertificate(), false, SslProtocols.Tls12, true);
//following line throws System.ArgumentException "Stream was not writable"
var writer = new BinaryWriter(sslStream);
writer.Write(abMessage, nStart, nLength);
But SslStream sslStream = new SslStream(socket.GetStream(),false);
is causing long delay.
Note that i'm using passive mode.
please can someone advice ? or eventually share his FTPS project ?
many thanks in advance.