iPhone certificate error in apns sharp A call to SSPI failed

China☆狼群 提交于 2019-12-04 05:54:43

got the solution i have just changed X509Certificate to X509Certificate2 and X509CertificateCollection to X509Certificate2Collection

I suggest you follow the steps in this tutorial to create a p12 file from you developer certificate.

http://help.adobe.com/en_US/as3/iphone/WS144092a96ffef7cc-371badff126abc17b1f-7fff.html

It's also important that you register this file in windows. This is as simple as double-clicking the file after you've generated it. Don't forget to update the call to the X509Certificate constructor afterwards.

The tutorial works equally well on Windows, but you might have to download an OpenSSL client which can be found here:

http://gnuwin32.sourceforge.net/packages/openssl.htm.

I do not know if this will be helpful after 3 years, but I leave the answer for iOS8.

Apple has changed the server security and right on the line you mention, you have to change from SSL to TLS:

Original code:

_apnsStream.AuthenticateAsClient(host,certificates,System.Security.Authentication.SslProtocols.Ssl3, false); 

New code:

_apnsStream.AuthenticateAsClient(host,certificates,System.Security.Authentication.SslProtocols.Tls, false);

I hope this information is helpful to someone.

Someone commented this in the GIT forum

Little late, but who knows if it helps somebody... I made a big mistake with the certificate, and installed the .CER I downloaded from Apple Developer Site... I know... my fault, but it could happen if you're as dumb as I am :-P

When you download the .CER, you have to import it into your keychain and then EXPORT the certificate INCLUDING the private key... that will generate a .P12 certificate, and THAT is the one you have to install in the Windows machine. Once I installed the .P12 in the LocalMachine/Personal store, the authentication worked just fine for me.

I got same problem, I use .p12 certificate file instead of .pfx and use moon-apns to send notification, the problem been solved.

Donwnload Moon-APNS code here: https://github.com/arashnorouzi/Moon-APNS

Try this :

SslStream sslStream = new SslStream(client.GetStream(), false);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!