使用 iPhone Apple 推送通知提供程序 (apns-sharp) 时出现 SslStream.AuthenticateAsClient 异常
使用 Apple 推送通知提供程序 (apns-sharp) 时,我收到以下异常。
推送通知可以在我的开发计算机上运行,但无法在 Rackspace 云托管中运行。我的开发人员正在运行精确的 Rackspace Cloud 自定义介质信任配置。机器,因此中等信任不是这里的问题。另外,证书文件不可能是问题,因为它适用于我的开发人员。机器。
有什么想法吗?
更新#1:这是否与 Rackspace 云服务器上可能不存在的 Entrust 根服务器有关?我检查了 apns-sharp 代码,看起来它忽略了证书验证,但我不能 100% 确定。
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.ForceAuthentication(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()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这有帮助吗?
Does this help?
对于继续遇到此异常的人:
我也遇到了同样的异常,并且阅读“apns-sharp”中的所有过程和论坛并没有帮助。从 MAC 导出证书一切都很好,我的问题是,当我使用默认配置在本地计算机中安装证书时,无法使用该证书,因为未导入 privateKey 。
然后当您打开新证书安装它时,您应该确保安装私钥。
在代码中你应该有这样的内容:
这已经解决了我的问题。
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:
That has solved my problem.
您是否关注过此页面:
http://code.google.com/p/apns-sharp/wiki/ HowToCreatePKCS12Certificate
另外,您可能有兴趣查看最新版本的 apns-sharp。它解决了许多问题。
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.
在我的情况下,此问题与我无法解决的 Rackspace 云站点上的中等信任安全性有关。为了克服这个问题,我改变了设计,使用 PHP 代码来访问 APNS。
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.