cancel
Showing results for 
Search instead for 
Did you mean: 

Problem using TLS for communication

1,474

Hello All,

I was trying to setup a connection to a server using TLS encryption using SQLAnywhere 17 but I always get a "TLS handshake failure" - any toughts?

Root

createcert.exe -b 2048 -x -ca 1 -co Root.crt -io Root.id -ko Root.pk -kp test -m 1 -sc PT -sst Test -sl Lisboa -so "Test" -sou Test -scn "Test" -u 1,2,3,4,5,6,7 -v 50

Server

createcert.exe -b 2048 -c Root.crt -ck Root.pk -cp test -ca 0 -co Server.crt -io Server.id -ko Server.pk -kp test -m 1 -sc PT -sst Test -sl Lisboa -so "Test" -sou Test -scn "Test" -u 1,2,3,4,5,6,7 -v 50

Client

createcert.exe -b 2048 -c Root.crt -ck Root.pk -cp test -ca 0 -co Client.crt -io Client.id -ko Client.pk -kp test -m 1 -sc PT -sst Test -sl Lisboa -so "Test" -sou Test -scn "Test" -u 1,2,3,4,5,6,7 -v 50

Server Launch

dbsrv17.exe -n SERVER -pc -ec tls(identity=server.id;identity_password=test;trusted_certificates=server.crt) -x tcpip "database.db"

Client Launch

dbisqlc.exe -c "ServerName=SERVER;Host=127.0.0.1;ENC=TLS(identity=client.id;identity_password=test;trusted_certificates=client.crt)

Thanks in advance, Rui Cruz

Accepted Solutions (1)

Accepted Solutions (1)

graeme_perrow
Advisor
Advisor

There are a few problems:

  1. The trusted_certificates option is used to specify the certificate that you trust, which should be the one that signed the one the other side is using. This means that in both your server command line and client connection string you should be specifying trusted_certificates=Root.crt.
  2. When creating the Server and Client certificates, don't specify Certificate Signing (6) as part of the -u switch. When creating the root certificate, use "-u 6, 7" and when creating the other two, use "-u 1,3,4,5".
  3. In a real-world situation, the common name of the server's certificate would be the name of the computer on which the server is running. In this case it's not, so you can tell the software not to check that name using the skip_certificate_name_check option.
  4. In your -c switch on the dbisqlc.exe command, the connection string begins with a quote but does not end with one.

So your server command should be:

dbsrv17.exe -n SERVER -pc -ec tls(identity=server.id;identity_password=test;trusted_certificates=Root.crt) -x tcpip "database.db"

and your client command should be:

dbisqlc.exe -c "ServerName=SERVER;Host=127.0.0.1;ENC=TLS(identity=client.id;identity_password=test;trusted_certificates=Root.crt;skip_certificate_name_check=1)"
0 Kudos

Thanks Graeme, the problem was the "skip_certificate_name_check" and the "common name" that was not the server name - all the other settings you suggested i already unsuccessfully tried and the example i've posted was only one of them.

Thank your very much!

Best regards, Rui Cruz

Answers (0)