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

PushSharp.Apple.ApnsConnectionException: SSL Stream Failed to Authenticate as Client #895

Open
raheem52 opened this issue Mar 13, 2019 · 18 comments

Comments

@raheem52
Copy link

I am using PushSharp 4.0.10

When I am trying to send iOS notification.

I receive below error

Send Batch Error: Batch ID=1, Error=PushSharp.Apple.ApnsConnectionException: SSL Stream Failed to Authenticate as Client ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> Interop+AppleCrypto+SslException: bad protocol version8
--- End of inner exception stack trace ---
at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, ExceptionDispatchInfo exception)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslStream.AuthenticateAsClient(SslClientAuthenticationOptions sslClientAuthenticationOptions)
at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
at PushSharp.Apple.ApnsConnection.connect()
--- End of inner exception stack trace ---
at PushSharp.Apple.ApnsConnection.connect()
at PushSharp.Apple.ApnsConnection.SendBatch()

@dannycabrera
Copy link

@raheem52 seeing same this morning too. Had some push notifications go out but occasionally getting this exception.

@MostafaSholkany
Copy link

Same error withe me

@Sebastian506563
Copy link

Sebastian506563 commented Mar 13, 2019

Same here,

  1. Tested only locally
  2. Started to fail after update to Windows 10.
  3. First notification after running always fails, next are fine.
    I am guessing something wrong with Tls1.0

@sevafeld
Copy link

Same here

@dannycabrera
Copy link

Just updated my code to force TLS 1.2 and waiting to see if this error shows up again.

System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

@dannycabrera
Copy link

No errors in about 4 hours so this might have done the trick. Thanks @Sebastian506563 for pointing out TLS issue.

@jlubeck
Copy link

jlubeck commented Mar 13, 2019

@dannycabrera where did you put that? I'm having the same issue, just put that line before apnsBroker.Start() and it's still failing for me...

@sonergonul
Copy link

@dannycabrera where did you put that? I'm having the same issue, just put that line before apnsBroker.Start() and it's still failing for me...

Usually this should put in your Application_Start method but this depends on your architecture of course.

@dannycabrera
Copy link

Thanks @sonergonul. Exactly where I placed it, right before any PushSharp initializing.

@jlubeck
Copy link

jlubeck commented Mar 14, 2019

Doing just that didn't fix it for me. I had to run this on the recommended settings to fix the Ciphers on my computer as well: https://www.nartac.com/Products/IISCrypto

@dannycabrera
Copy link

@jlubeck curious, what OS are you running PushSharp on?

@jlubeck
Copy link

jlubeck commented Mar 14, 2019

@dannycabrera Windows Server 2012

@danhudsonfortyau
Copy link

Is there a chance anyone will update the nuget package to include the TLS fix?

@harvey-green
Copy link

I had this same issue, so checked out the master branch and built the project locally. Then included the references to the required DLLs (Apple and Core) manually into my project. The NuGet package for PushSharp is 3 years old and so does not include the required fixes for TLS 1.2.

@harvey-green
Copy link

By the way I was doing sandbox Apple VoIP push notifications via

gateway.sandbox.push.apple.com - port 2195

feedback.sandbox.push.apple.com - port 2196

They started failing on 23 July. Prior to that they were working fine with the NuGet package.

@xilibro
Copy link

xilibro commented Jul 30, 2019

oh my god, it has taking my two days.

@xilibro
Copy link

xilibro commented Jul 30, 2019

I had this same issue, so checked out the master branch and built the project locally. Then included the references to the required DLLs (Apple and Core) manually into my project. The NuGet package for PushSharp is 3 years old and so does not include the required fixes for TLS 1.2.

love you so much

@danhudsonfortyau
Copy link

The last two links are references to the updated PushSharp nuget. I'm not sure if the original author is trying to monentize PushSharp or if its a branch of someone else's. I ran the nuget packages and got past the current set of Tls errors related to Apple updates. Hope this helps folks.

https://nugetmusthaves.com/Package/LogicSoftware.PushSharp
https://nugetmusthaves.com/Package/LogicSoftware.PushSharp
https://nugetmusthaves.com/Package/PushSharp.NetCore2.1

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

10 participants