1

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
  • Could you please upload the full log? – Jessie Zhang -MSFT Aug 26 '22 at 02:41
  • build logs and debug logs. Link to the archive in google disk [log debug and build](https://drive.google.com/file/d/1FUNLBMVQNyyswL0im-mB38xjL0qYuM-l/view?usp=sharing) – Dmitry Ivanov Aug 26 '22 at 13:42
  • We have checked all possible options. Including connected the Let's Encrypt certificate to the server. There is no effect. I think that the problem is in porting the library. – Dmitry Ivanov Aug 26 '22 at 18:17
  • `We have checked all possible options.` What options have you tried ? The below links will be helpful for you to resolve this issue: https://stackoverflow.com/questions/25122287/java-security-cert-certpathvalidatorexception-trust-anchor-for-certification-pa . – Jessie Zhang -MSFT Sep 06 '22 at 06:37
  • I do not see how you can use these recommendations from the MAUI project. MAUI->NPGSQl->C#->Java script compilation process goes on without my participation and somewhere along the way an indication of trust in a self-signed certificate is lost. – Dmitry Ivanov Nov 18 '22 at 01:17

0 Answers0