[Mono-dev] ClientCertificateValidation SSL in MONO

Dominik domi.w at gmx.de
Wed Aug 13 09:26:21 EDT 2008


hi,
i'm trying to  connect with ssl as client but the callback function 
never invoked and the server do not become any data... do you know why 
its not working?
i'm using SSL3 / TLSv1

On the server side(Authenticate as server works fine but not as client) 
it seems all must be correct... :(

here is my code in vb.net to authenticate as client:

                           DataSSLStream = New 
Mono.Security.Protocol.Tls.SslServerStream(DataSock.GetStream, 
X509Certificate.CreateFromCertFile("/home/mono/ssl.cer"), True, False)
                           DataSSLStream.PrivateKeyCertSelectionDelegate 
= New PrivateKeySelectionCallback(AddressOf GetPrivateKey)
                           DataSSLStream.ClientCertValidationDelegate = 
New CertificateValidationCallback(AddressOf VerifyClientCertificate)

       Private Function GetPrivateKey(ByVal certificate As 
X509Certificate, ByVal targetHost As String) As AsymmetricAlgorithm
           Dim key As PrivateKey = 
PrivateKey.CreateFromFile("/home/mono/ssl.pvk", "password")
           Return key.RSA
       End Function 'GetPrivateKey

       Private Function VerifyClientCertificate(ByVal certificate As 
X509Certificate, ByVal certificateErrors() As Integer) As Boolean
           If certificate IsNot Nothing Then
               Console.WriteLine(certificate.ToString(True))
           Else
               Console.WriteLine("No client certificate provided.")
           End If
           Return True
       End Function

I hope you can help me, thanks!!
Dominik


More information about the Mono-devel-list mailing list