Search code examples
c#postgresqlazuretls1.2devart

Problem accessing PostgreSql with TLS 1.2 using Devart library


I'm using the library Devart.Data.PostgreSql (https://www.nuget.org/packages/Devart.Data.PostgreSql/) to interact with PostgreSQL from a C# application, but I run into problems when I try to connect to a PostgreSQL instance hosted in Azure that enforces TLS 1.2. From what I understand there is a problem with ciphers not being able to match during the handshake as I end up with this exception:

Devart.Data.PostgreSql.PgSqlException (0x80004005): Authentication failed in ssl mode. --->
Devart.Data.PostgreSql.PgSqlException (0x80004005): FIPS cipher suites are enforced for this
server. Please specify FIPS complying cipher suites in your SSL/TLS settings.

How can I identify which ciphers are available to me, and how can I control which ciphers to use? I see Microsoft has a list of ciphers it supports for this type of connections so I assume I need to match one of these, but I'm at a loss as to how to control this in my application:

https://learn.microsoft.com/en-us/azure/postgresql/concepts-ssl-connection-security#cipher-support-by-azure-database-for-postgresql-single-server


Solution

    1. Full support of TLS 1.2 in SSL connections for .NET Standard (.NET Core) Projects was implemented in dotConnect for PostgreSQL v7.20.1860 01-Apr-21.

    2. With .NET Framework projects, use assemblies compiled for .NET Framework 4.7:

    • "C:\Program Files (x86)\Devart\dotConnect\PostgreSQL\NET4\Devart.Data.dll"
    • "C:\Program Files (x86)\Devart\dotConnect\PostgreSQL\NET4\Devart.Data.PostgreSql.dll"

    Please select the "Do not install assemblies in the GAC" option in Setup Wizard. Otherwise, the runtime will use assemblies compiled for .NET Framework 2.0 from GAC.