APNS ssl://gateway.sandbox.push.apple.com:2195 连接失败 [英] APNS ssl://gateway.sandbox.push.apple.com:2195 connection fails

查看:88
本文介绍了APNS ssl://gateway.sandbox.push.apple.com:2195 连接失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试制作一个推送通知服务器.我通过 telnet 连接到 ssl://gateway.sandbox.push.apple.com:2195.

i try to make a push-notification server. I get connection to ssl://gateway.sandbox.push.apple.com:2195 with telnet.

telnet gateway.sandbox.push.apple.com 2195
Trying 17.172.232.229...
Connected to gateway.sandbox.push-apple.com.akadns.net.
Escape character is '^]'.

我的 *.pem 没问题(我在另一台服务器上使用它).我在另一台服务器上使用了 SAME 项目,它在那里工作,但另一台服务器上的克隆没有.

my *.pem is ok (I use it on another server). I use the SAME project on an other Server and it works there but the clone on an other Server doesn't.

我收到这些错误:

Warning: stream_socket_client() [function.stream-socket-client]: SSL operation failed with code 1. OpenSSL Error messages: error:14094415:SSL routines:SSL3_READ_BYTES:sslv3 alert certificate expired in /var/www/try.php on line 69

Warning: stream_socket_client() [function.stream-socket-client]: Failed to enable crypto in /var/www/try.php on line 69

Warning: stream_socket_client() [function.stream-socket-client]: unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /var/www/try.php on line 69

证书没有过期,它在另一台服务器上有效,日期相同.

The certificate is NOT expired, it works on the other Server and the date is the same.

有人知道错误可能是什么吗?

Does someone has a clue what the mistake could be?

我在工作

Apache/2.2.9 (Debian) PHP/5.2.17-0.dotdeb.0 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g

看来,在不同的服务器上使用相同的证书是行不通的.可能是被苹果服务器屏蔽了.

It seems, that using the same certificate on different servers doesn't work. Maybe this is blocked by Apples servers.

推荐答案

为此我使用 apn_on_rails,但我认为只要您使用 pem 文件,它就会对您有用.我通过重新下载证书和中间证书解决了这个问题,使用以下说明重新生成推送通知 pem 文件:

I use apn_on_rails for this, but I think it will work for you as long as you are using a pem file. I fixed this by re-downloading the certificate and intermediate certificate, regenerating the push notification pem file using these instructions:

获得 Apple 为您的应用程序提供的证书后,导出您的密钥和苹果证书作为 p12 文件.以下是有关如何执行此操作的快速演练:

Once you have the certificate from Apple for your application, export your key and the apple certificate as p12 files. Here is a quick walkthrough on how to do this:

1. Click the disclosure arrow next to your certificate in Keychain Access and select the certificate and the key. 
2. Right click and choose `Export 2 items…`. 
3. Choose the p12 format from the drop down and name it `cert.p12`.

Now covert the p12 file to a pem file:  

  $ openssl pkcs12 -in cert.p12 -out apple_push_notification_production.pem -nodes -clcerts

这篇关于APNS ssl://gateway.sandbox.push.apple.com:2195 连接失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆