开发者

SslStream.AuthenticateAsClient Exception when using iPhone Apple Push Notification Provider (apns-sharp)

I receive the following exception when using the Apple Push Notification Provider (apns-sharp).

The push notifications work on my development machine however it will not work within the Rackspace Cloud hosting. I have the exact Rackspace Cloud custom medium trust configuration running with my dev. machine so the medium trust can't be the issue here. Also, the certificate file can't be the issue as it works on my dev. machine.

Any ideas?

Update #1: Would this have something to do with the Entrust root server that may not be on the Rackspace Cloud servers? I checked into the apns-sharp code and it looks like it ignores the certificate verification but I'm not 100% sure.

The credentials supplied to the package were not recognized    at System.Net.SSPIWrapper.AcquireCredentialsHandle(SSPIInterface SecModule, String package, CredentialUse intent, SecureCredential scc)
  at System.Net.Security.SecureChannel.AcquireCredentialsHandle(CredentialUse credUsage, SecureCredential& secureCredential)
  at System.Net.Security.SecureChannel.AcquireClientCredentials(Byte[]& thumbPrint)
  at System.Net.Security.SecureChannel.GenerateToken(Byte[] input, Int32 offset, Int32 count, Byte[]& output)
  at System.Net.Security.SecureChannel.NextMessage(Byte[] incoming, Int32 offset, Int32 count)
  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.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.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.ForceAut开发者_运维百科hentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
  at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
  at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean checkCertificateRevocation)
  at JdSoft.Apple.Apns.Notifications.NotificationConnection.OpenSslStream()
  at JdSoft.Apple.Apns.Notifications.NotificationConnection.Reconnect()
  at JdSoft.Apple.Apns.Notifications.NotificationConnection.workerMethod()


Does this help?

  • apns-sharp: Issue 3: Credentials supplied to the package were not recognized


For people that continues getting this exception:

I had the same exception and reading about all procedures and forums in 'apns-sharp' did not help. All was good about export the certificate from the MAC, my problem was that as I was installing the certificate in the local machine with the configurations by default, that certificate could not be used because the privateKey was not imported. Then when you open a new certificate to install it, you should ensure to install the private key. In code you should have something like:

new X509Certificate2(rawCertificateInBytes, Password, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet);

That has solved my problem.


Did you follow this page: http://code.google.com/p/apns-sharp/wiki/HowToCreatePKCS12Certificate

Also, you may be interested in checking out the latest version of apns-sharp. It has many issues resolved.


In my situation this issue was related to the Medium Trust security on the Rackspace Cloud Sites that I was unable to resolve. To overcome this issue I changed the design to use PHP code to access the APNS.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜