Redth / PushSharp

A server-side library for sending Push Notifications to iOS (iPhone/iPad APNS), Android (C2DM and GCM - Google Cloud Message), Windows Phone, Windows 8, Amazon, Blackberry, and (soon) FirefoxOS devices!
Other
4.38k stars 1.52k forks source link

Apple certificate validation check work fo PushSharp 2.* but don't work for 3.0.1 #631

Closed IAfanasov closed 8 years ago

IAfanasov commented 8 years ago

What version of PushSharp are you using?

nuget package 3.0.1

Describe your issue:

Apple push certificate works well with PushSharp 2.* but did't pass validation check in 3.0.1. It fails in file ApnsConfiguration rows:

string name2 = this.Certificate.SubjectName.Name;
.....
if (!name2.Contains("Apple Push Services:") && !name2.Contains("Website Push ID:"))
        throw new ApnsConnectionException("Your Certificate is not in the new combined Sandbox/Production APNS certificate format, please create a new single certificate to use");

I have two certificates. One for text alert and one for voip. I checked values of theirs System.Security.Cryptography.X509Certificates.X509Certificate2.SubjectName.Name properties. One contains "Apple Development IOS Push Services" and another one contains "VoIP Services".

What are the steps required to reproduce this issue?

call ApnsConfiguration constructor

Please provide any Exception Stack Traces

at PushSharp.Apple.ApnsConfiguration.CheckIsApnsCertificate() at PushSharp.Apple.ApnsConfiguration.Initialize(ApnsServerEnvironment serverEnvironment, X509Certificate2 certificate) at PushSharp.Apple.ApnsConfiguration..ctor(ApnsServerEnvironment serverEnvironment, Byte[] certificateData, String certificateFilePwd) at TCClassLib.MobileApps.Push.AppPushBrokers.GetApplePushBroker(App app, Boolean isDebug, Boolean isVoipPush) in F:\1Forma src\TCClassLib\MobileApps\Push\AppPushBrokers.cs:line 61

IAfanasov commented 8 years ago

We finished by changing certificated. Figured out from colleges that it was planned