[Mono-dev] TDS 8.0 and SslClientStream
Sebastien Pouliot
sebastien.pouliot at gmail.com
Tue Nov 28 08:32:55 EST 2006
Hello Dmitry,
On Tue, 2006-11-28 at 10:57 +0400, Dmitry Key wrote:
> Hi, all
>
> I am working on TDS 8.0 network protocol for the SqlClient and facing with
> the problem of the handshaking implementation. The corresponding TDS packet
> consists of the TDS header and TDS body with the TLS handshake packet. So to
> parse server response we have to read entire TDS packet, analyze its type
> and, if necessary, extract TLS part and send it to the SslClientStream
> class. But this class uses asynchronous Stream.BeginRead/EndRead methods in
> the handshake procedure and it is impossible read data asynchronously from
> the internal buffer. I see two methods to resolve such a problem.
> 1) Rewrite handshake code of the SslClientStream/SslBaseStream in the
> synchronous manner.
This code used to be synchronous (see SVN history) and had to be changed
to make it work correctly in every case.
> Another reason to do it is the following: SslStream
> class from .Net 2.0 uses synchronous methods to make handshake and as far as
Wrong. The handshake must be done async if the read/write that initiates
an handshake is async. Believe me, we tried, for a long time, in
Mono.Security ;-)
Anyway I don't see how you come to the conclusion that SslStream use a
synchronous method for doing it's handshake. Does your code works around
the 2.0 API ?
> I understand Mono version of this class will be implemented on the basis of
> the Mono.Security.
"basis" is well said. It will be based on Mono.Security, but it's still
undecided if this is gonna be a total rewrite (which would requires lot
of time and tests) or a thin wrapper around existing code (easier but we
still have the same issues, like high amount of memory allocations).
A few people have attempted both approach but never complete the task.
> 2) Implement IAsyncResult interface in such a way that it will be possible
> to read data from memory buffer asynchronously. I suppose it can be done as
> the extension of the MemoryStream class.
That's probably much easier and has a lower chance of affecting the
current users of the SSL/TLS code.
> In any case the good knowledge of Mono.Security internals is required. So
> could some Mono guru help me to solve my problem?
--
Sebastien Pouliot <sebastien at ximian.com>
Blog: http://pages.infinit.net/ctech/
More information about the Mono-devel-list
mailing list