admin管理员组

文章数量:1122832

In MAUI Android application I'm getting a strange SSL exception that starts appearing on larger responses. The larger response is, the more probability of this exception I get. The same request could succeed after few retries.

The response is a custom binary format wrapped in a GZip stream. When the error occurs in .NET it manifests itself by a standard HttpRequestException "Error while copying content to a stream." which wraps Javax.Net.Ssl.SSLProtocolException with the following error:

Read error: ssl=0x754d4d100b98: Failure in SSL library, usually a protocol error 
error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT (external/boringssl/src/crypto/fipsmodule/cipher/e_aes.c:1078 0x754c37dd7112:0x00000000) 
error:1000008b:SSL routines:OPENSSL_internal:DECRYPTION_FAILED_OR_BAD_RECORD_MAC (external/boringssl/src/ssl/tls_record:294 0x754c37dd7112:0x00000000)

I've tried a few hints I found online, like

  • re-using HttpClient where possible (as this may be a re-use of a non-thread-safe SSL handle by internal SSL library)
  • using different implementations of HttpMessageHandler (HttpClientHandler/AndroidMessageHandler)
  • toggling HttpCompletionOption.ResponseContentRead/ResponseHeadersRead

I've also checked on different certificates by connecting to systems where there are many Xamarin devices calling those endpoints without issues.

Would appreciate more ideas to try.

本文标签: netIntermittent SSL Error in MAUI Android using HttpClientStack Overflow