HttpTwo icon indicating copy to clipboard operation
HttpTwo copied to clipboard

Http2 Library

Open MicaMikey opened this issue 8 years ago • 3 comments

Hi,

I am testing the Http2 library and having issues with connecting to Apple. The issue is in the following line of code:

await sslStream.AuthenticateAsClientAsync( ConnectionSettings.Host, ConnectionSettings.Certificates ?? new X509CertificateCollection(), System.Security.Authentication.SslProtocols.Tls12, false).ConfigureAwait(false); The Error message is "The message received was unexpected or badly formatted" and when I use wireshark and look at the packets received I see that there is a Handshake issue reported by apple failure 40.

I am quite certain that the p12 file I have created is fine because I can use it on gateway.push.apple.com with port 2195 and it works fine. I have checked the certificate and it is production cert that supports HTTP2 it has the right info in the cert itself such as Apple Push Services. I was wondering have you managed to run the HTTP2 code successful to connect to apple at all? I have even installed the GeoTrust Global CA cert and that didn't help. I can verify and connect to apple using openssl as long as GeoTrust Global CA is attached to the call.

I am torn between some sort of issue in the P12 file although I think it was created properly or the fact that .net isn't sending the certificate information properly to apple. I saw that ALPN wasn't supported by .net just yet!!!

Appreciate your help.

Regards, mike

MicaMikey avatar Jun 29 '16 14:06 MicaMikey

I have experienced the same error sometimes. It auto recover after a few hours. It throws "The message received was unexpected or badly formatted" because underlying connection was reset.

Update: Seems like Apple drops support of lesser secured cipher algorithm, and close the connection after client-hello TLS handshake.

Neio avatar Jul 13 '17 10:07 Neio

@Neio How did you deal with this problem? I also encountered this problem in win7 system, and I can communicate normally in win10 system.

lzy-gogo avatar May 08 '21 07:05 lzy-gogo

@lzy-gogo , in win7, I implemented a BouncyCastle layer to handle the TLS connection.

Neio avatar May 27 '21 07:05 Neio