NPGSQL Exception while performing SSL handshake

I'm using a test self-signed server certificate. Without client certificates. I can't find the cause of the error:

net6.0-android;net6.0-ios;net6.0-maccatalyst net6.0-windows10.0.19041.0

PostgreSQL 14.5, compiled by Visual C++ build 1914, 64-bit

pg_sb.SslMode = Npgsql.SslMode.Require;
pg_sb.TrustServerCertificate = true;
pg_sb.IncludeErrorDetail = true;

Windows Machine net6.0-windows10 Npgsql 6.0.6 SSL handshake - OK

Android net6.0-Android 12 API 31 Npgsql 6.0.6

SSL handshake:

 {Npgsql.NpgsqlException (0x80004005): Exception while performing SSL handshake ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> Interop+AndroidCrypto+SslException: Exception of type 'Interop+AndroidCrypto+SslException' was thrown. --- End of inner exception stack trace --- at System.Net.Security.SslStream.<ForceAuthenticationAsync>d__175`1 [[System.Net.Security.SyncReadWriteAdapter, System.Net.Security, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext() at System.Net.Security.SslStream.AuthenticateAsClient (SslClientAuthenticationOptions sslClientAuthenticationOptions) at System.Net.Security.SslStream.AuthenticateAsClient (String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation) at Npgsql.Internal.NpgsqlConnector.RawOpen(SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken, Boolean isFirstAttempt) at Npgsql.Internal.NpgsqlConnector.RawOpen(SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken, Boolean isFirstAttempt) at Npgsql.Internal.NpgsqlConnector.<Open>g__OpenCore|191_1 (NpgsqlConnector conn, SslMode sslMode, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken, Boolean isFirstAttempt) at Npgsql.Internal.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.UnpooledConnectorSource.Get(NpgsqlConnection conn, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlConnection.<Open>g__OpenAsync|45_0(Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlConnection.Open() at pgDynProc.poolcn.connect.Open() in Npgsql.NpgsqlException
5 Related questions 1 Resolving "ssl handshake failure" error in PostgresQL 2 "bad record MAC" SSL error between Java and PortgreSQL 2 SSL errors when using Npgsql and SSL certificate authentication Related questions 1 Resolving "ssl handshake failure" error in PostgresQL 2 "bad record MAC" SSL error between Java and PortgreSQL 2 SSL errors when using Npgsql and SSL certificate authentication 13 Error connecting to server : received invalid response to SSL negotiation 4 Error: "Couldn't set ssl mode" 1 Postgres don't allow my application to connect 17 How to connect with PostgreSQL database over SSL? 5 org.postgresql.util.PSQLException: The server does not support SSL 3 SSL connection error in PostgreSQL 8.0 1 Cannot connect over SSL using PostgreSQL JDBC driver Load 7 more related questions Show fewer related questions Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like