I'm using Devart dotConnect for MySql version 6.30.165.0 and i have trouble connecting with SSL.
If I use CaCert, Cert and Key properties of MySqlConnection.SslOptions MySql responds with
Code: Select all
SSL connection error (2026):
Verification check of remote certificate failed.
This is a code snippet that doesn't work
Code: Select all
static void Main(string[] args)
{
var myConn = new MySqlConnection("host=localhost;protocol=SSL;user=ssluser;password=localusrpass;database=testssl");
myConn.SslOptions.CACert = "file://c:\certs\CA-cert.pem";
myConn.SslOptions.Cert = "file://c:\Certs\client-cert.pem";
myConn.SslOptions.Key = "file://c:\Certs\client-key.pem";
var myCommand = new MySqlCommand("select count(*) from tbl1", myConn);
try
{
myConn.Open();
Int64 count = Convert.ToInt64(myCommand.ExecuteScalar());
Console.WriteLine(count);
myConn.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.ReadLine();
}
Code: Select all
static void Main(string[] args)
{
var myConn = new MySqlConnection("host=localhost;protocol=SSL;user=ssluser;password=localusrpass;database=testssl");
//myConn.SslOptions.CACert = "file://c:\certs\CA-cert.pem";
myConn.SslOptions.Cert = "file://c:\Certs\client-cert.pem";
myConn.SslOptions.Key = "file://c:\Certs\client-key.pem";
var myCommand = new MySqlCommand("select count(*) from tbl1", myConn);
try
{
myConn.Open();
Int64 count = Convert.ToInt64(myCommand.ExecuteScalar());
Console.WriteLine(count);
myConn.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.ReadLine();
}
Certificates are valid, using all of the three files works well when connecting directly to mysql from console.
Thanks.