SSL Connection Problem with Xamarin

Marco Spallone 1 Reputation point
2022-03-10T15:35:20.697+00:00

Hi,
I have a Xamarin cross-platfrom application. It works fine on Android Emulator, but I've connected an Android device to debug mode and when i try to make an HTTP request I have the following error:

"System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> Mono.Btls.MonoBtlsException: Ssl error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER at /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/boringssl/ssl/tls_record.c:217"

Can I solve it?

Thank you very much!

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,326 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,648 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 29,381 Reputation points Microsoft Vendor
    2022-03-11T05:16:49.967+00:00

    Hello @Marco Spallone ,

    This error means that there is something wrong when verifying server certificates. You could check if the server only has the wildcard certificate keychain or miss the certificate authority.
    As the native Android document describes, Android typically trust only root CAs directly, which leaves a short gap of trust between the server certificate—signed by the intermediate CA—and the certificate verifier, which knows the root CA. To solve this, the server doesn't send the client only it's certificate during the SSL handshake, but a chain of certificates from the server CA through any intermediates necessary to reach a trusted root CA.

    For more details, please refer to this doc: https://developer.android.com/training/articles/security-ssl

    Best Regards,
    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.