[Mono-list] SslStream

Jonathan Gagnon jonathan.gagnon at croesus.com
Tue Feb 13 17:51:08 EST 2007


I have a server application that uses the SslStream class and I would like
to make it work in mono.  It seems like the SslStream class is not
implemented yet but that I could use SslServerStream to make it work.
Unfortunately, that doesn't seem to work in my case.  I always get the
following error :
 
System.IO.IOException: The authentication or decryption has failed. --->
Mono.Security.Protocol.Tls.TlsException: Server certificate Private Key
unavailable.
  at
Mono.Security.Protocol.Tls.Handshake.Server.TlsClientKeyExchange.ProcessAsTl
s1 () [0x00000]
  at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process ()
[0x00000]
  at (wrapper remoting-invoke-with-check)
Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()
  at Mono.Security.Protocol.Tls.ServerRecordProtocol.ProcessHandshakeMessage
(Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000]
  at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback
(IAsyncResult asyncResult) [0x00000] --- End of inner exception stack trace
---
  at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback
(IAsyncResult asyncResult) [0x00000]
 
Here's what my code looks like :
 
    X509Certificate certificate = new
X509Certificate("c:\\certificate.cer");
    SslServerStream sslStream = new SslServerStream(tcpClient.GetStream(),
certificate);
 
Here is the code that works when I run the application with .NET, using the
SslStream class :
 
    X509Certificate certificate = new
X509Certificate("c:\\certificate.cer");
    SslStream sslStream = new SslStream(tcpClient.GetStream());
    sslStream.AuthenticateAsServer(certificate);
 
The certificate file was created using the makecert tool that comes with
.NET.  It seems like mono is unable to retrieve the private key from it.
 
Any idea what the problem could be, or what I could do to make it work with
mono?
 
Thanks,
 
Jonathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20070213/391fb998/attachment.html 


More information about the Mono-list mailing list