Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android libmsquic ConnectAsync Throw exception #4728

Open
1 of 4 tasks
xlievo opened this issue Jan 1, 2025 · 0 comments
Open
1 of 4 tasks

android libmsquic ConnectAsync Throw exception #4728

xlievo opened this issue Jan 1, 2025 · 0 comments

Comments

@xlievo
Copy link

xlievo commented Jan 1, 2025

Describe the bug

In simple terms, I compiled the OpenSSL3 version of libsquic for Android ARM64-v8a based on the documentation, and utilized it within a .NET 8.0 Android project to establish a QUIC connection to the server.
https://github.com/microsoft/msquic/blob/main/docs/BUILD.md

pwsh ./scripts/build.ps1 -Platform android -Arch arm64 -Config Release

Additionally, OpenSSL for msquic was compiled according to the documentation.
https://github.com/quictls/openssl

So far, three native libraries have been obtained: libcrypto.so, libssl.so, and libmsquic.so.

Here are the exceptions thrown during usage on the Android 14 system. I'm not sure if this is related to OpenSSL?
It's important to note that the same code connects successfully on Windows x64.

Affected OS

  • Windows
  • Linux
  • macOS
  • Other (specify below)

Additional OS information

android arm64-v8a

MsQuic version

main

Steps taken to reproduce bug

var con = await QuicConnection.ConnectAsync(new QuicClientConnectionOptions
{
    IdleTimeout = TimeSpan.MaxValue,
    RemoteEndPoint = new IPEndPoint(endPoint.Address.MapToIPv4(), 9000),
    DefaultCloseErrorCode = 0x0A,
    DefaultStreamErrorCode = 0x0B,
    ClientAuthenticationOptions = new SslClientAuthenticationOptions
    {
        ApplicationProtocols = [SslApplicationProtocol.Http3],
        RemoteCertificateValidationCallback = (sender, certificate, chain, errors) => true,
        TargetHost = "localhost"
    }
});

Expected behavior

proper connection.

Actual outcome

The type initializer for 'Crypto' threw an exception.

   at System.Net.Security.CertificateValidation.BuildChainAndVerifyProperties(X509Chain chain, X509Certificate2 remoteCertificate, Boolean checkCertName, Boolean _, String hostName)
   at System.Net.Security.CertificateValidation.BuildChainAndVerifyProperties(X509Chain chain, X509Certificate2 remoteCertificate, Boolean checkCertName, Boolean isServer, String hostName, IntPtr certificateBuffer, Int32 bufferLength)
   at System.Net.Quic.QuicConnection.SslConnectionOptions.ValidateCertificate(QUIC_BUFFER* certificatePtr, QUIC_BUFFER* chainPtr, X509Certificate2& certificate)
   at System.Net.Quic.QuicConnection.HandleEventPeerCertificateReceived(_PEER_CERTIFICATE_RECEIVED_e__Struct& data)
--- End of stack trace from previous location ---
   at System.Net.Quic.ValueTaskSource.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Net.Quic.QuicConnection.FinishConnectAsync(QuicClientConnectionOptions options, CancellationToken cancellationToken)
   at System.Net.Quic.QuicConnection.<ConnectAsync>g__StartConnectAsync|2_0(QuicClientConnectionOptions options, CancellationToken cancellationToken)
   at System.Net.Quic.QuicConnection.<ConnectAsync>g__StartConnectAsync|2_0(QuicClientConnectionOptions options, CancellationToken cancellationToken)

Additional details

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant