我有一个应用程序的推送通知服务启用到现在为止,没有问题。但昨天我犯了一个错误,撤销了一个证书,通知也不起作用。然后,我创建了一个新的apns生产证书(.p12文件),并将其放入服务器中。但是现在我有了以下错误:
System.IO.IOException :身份验证失败,因为远程端关闭了传输流。
在论坛上阅读时,我注意到不支持ssl3安全性,然后我尝试更改为tls。但是当我尝试这个时,我有一个错误:
远程侧关闭了传输流。
我尝试用2048位RSA私钥生成.p12文件,但没有结果。
这个mi服务器代码。我在用MoonApns。
certificate = If(String.IsNullOrEmpty(p12FilePassword), New X509Certificate2(File.ReadAllBytes(P12File)), New X509Certificate2(File.ReadAllBytes(P12File), p12FilePassword, X509KeyStorageFlags.MachineKeySet))
_certificates = New X509Certificate2Collection()
_certificates.Add(_certificate)
Dim _apnsClient As TcpClientapnsClient = New TcpClient()
_apnsClient.Connect(ProductionHost, NotificationPort)
Dim _apnsStream As SslStream = New SslStream(_apnsClient.GetStream(), False, AddressOf validateServerCertificate, AddressOf SelectLocalCertificate)
Try
_apnsStream.AuthenticateAsClient(ProductionHost, _certificates, System.Security.Authentication.SslProtocols.Tls, False)
Catch ex As System.Security.Authentication.AuthenticationException
Throw ex
End Try谢谢你的帮助。
问候
发布于 2015-09-07 08:08:12
我找到了自己的解决方案!
如果您使用带有.p12证书的月亮APNS,并且需要使用tls安全性,则必须在apns服务器中安装apns_production.cer。如果没有这种情况,系统中可能会出现套接字异常。
谢谢
https://stackoverflow.com/questions/32421204
复制相似问题