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

Bug - A call to SSPI failed, see inner exception. #368

Closed
danicomas opened this issue Apr 16, 2014 · 7 comments
Closed

Bug - A call to SSPI failed, see inner exception. #368

danicomas opened this issue Apr 16, 2014 · 7 comments

Comments

@danicomas
Copy link

A few days ago the library stopped working and it showed me the next error:

Channel Created for: PushSharp.Apple.ApplePushService
Channel Exception: PushSharp.Apple.ApplePushService -> System.Security.Authentic
ation.AuthenticationException: A call to SSPI failed, see inner exception. ---> System.ComponentModel.Win32Exception: The message received was unexpected or badly
  --- End of inner exception stack trace ---
   en System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken messag
e, AsyncProtocolRequest asyncRequest, Exception exception)
   en System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, A
syncProtocolRequest asyncRequest)
   en System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 coun
t, AsyncProtocolRequest asyncRequest)
   en System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocol
Request asyncRequest)
   en System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, A
syncProtocolRequest asyncRequest)
   en System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byt
e[] buffer, AsyncProtocolRequest asyncRequest)
   en System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyRes
ult)
   en PushSharp.Apple.FeedbackService.Run(ApplePushChannelSettings settings, Can
cellationToken cancelToken)
   en PushSharp.Apple.ApplePushService.<>c__DisplayClass4.<.ctor>b__1(Object sta
te)
Failure: PushSharp.Apple.ApplePushService -> The maximum number of Send attempts
 to send the notification was reached! -> {"aps":{"alert":"Hello!!.","ba
dge":7,"sound":"sound.caf"},"PushNotificationType":"Hi","OtherParam":"Hi!"}

I have tested to direct connection without firewall and the result is the same.

My program's code is the next:

var push = new PushBroker();
push.OnNotificationSent += NotificationSent;
push.OnChannelException += ChannelException;
push.OnServiceException += ServiceException;
push.OnNotificationFailed += NotificationFailed;
push.OnDeviceSubscriptionExpired += DeviceSubscriptionExpired;
push.OnDeviceSubscriptionChanged += DeviceSubscriptionChanged;
push.OnChannelCreated += ChannelCreated;
push.OnChannelDestroyed += ChannelDestroyed;

var appleCert = File.ReadAllBytes(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "certificate.p12"));

push.RegisterAppleService(new ApplePushChannelSettings(appleCert, ""));

push.QueueNotification(new AppleNotification()
                                       .ForDeviceToken("ca883fbcfcb1eda42af71d81ca82c60a087fe10e462a7a940a6bab4066cba826")
                                       .WithAlert("Hello!!.")
                                       .WithBadge(7)
                                       .WithSound("sound.caf")
                                       .WithCustomItem("PushNotificationType", "Hi")
                                       .WithCustomItem("OtherParam", "Hi!"));

Console.WriteLine("Waiting for Queue to Finish...");
push.StopAllServices();
Console.WriteLine("Queue Finished, press return to exit...");
Console.ReadLine();

Thanks in advance!

@coffeesmurf
Copy link

Hi,

We were having the same issue using the now depricated APNS-Sharp library (ancestor to PushSharp). I submitted a pull request for APNS-Sharp that fixes the issue based on my tests.

The modification was to change (in ApplePushChannel.cs)

stream.AuthenticateAsClient(this.appleSettings.Host, this.certificates, System.Security.Authentication.SslProtocols.Ssl3, false);

to

stream.AuthenticateAsClient(this.appleSettings.Host, this.certificates, System.Security.Authentication.SslProtocols.Tls, false);

I didn't find a confirmation on this, but it looked like the SSL3 protocol was no longer supported by the Sandbox APNS. Like others that reported the issue, my notifications against the Production APNS were still working.

You can find the pull request here:

https://github.com/Redth/PushSharp/pull/369/files

@mobilesoftsmith
Copy link

I encountered this issue too. I originally thought it's my .p12 file issue. But now I am sure this is a bug when I pushed a message through another library successfully with the same .p12 file.

@danicomas
Copy link
Author

I have closed the issue, the problem was the .p12 certificate. Dev and Production app ID was the same.

Thanks!

@suresh-dev
Copy link

still i am facing the problem can anyone please let me know what i have missed.
I have ssl certificate installed on my machine

@Harinder
Copy link

SSL3 support has been removed by apple. It is for both Pre-Prod (Development) and Production environment. However, TLS should be working fine.

Here is the link to official announcement.
https://developer.apple.com/news/?id=10222014a

@coffeesmurf thanks for your changes!

@bhanu111
Copy link

bhanu111 commented Nov 7, 2014

I have ssl and tls both enabled on my domain and i am using jdsoft library to send ios push notifications. It was working fine but from 7 days i am not able to send push notifications. I am getting this error "A Call to SSPI failed, see inner exception". Can some help please?

@pedroadaodev
Copy link

I was using "PushSharp" version="2.0.4.0". Just updated to "PushSharp" version="2.2.1.0" and it started working. Thanks! =)

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

7 participants