APNS ssl://gateway.sandbox.push.apple.com:2195连接失败

Sta*_*bax 15 ssl push apple-push-notifications

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

telnet gateway.sandbox.push.apple.com 2195
Trying 17.172.232.229...
Connected to gateway.sandbox.push-apple.com.akadns.net.
Escape character is '^]'.
Run Code Online (Sandbox Code Playgroud)

我的*.pem还可以(我在另一台服务器上使用它).我在另一台服务器上使用SAME项目,它在那里工作,但其他服务器上的克隆没有.

我得到这些错误:

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
Run Code Online (Sandbox Code Playgroud)

证书未过期,它适用于其他服务器,日期相同.

有人知道错误是什么吗?

我继续努力

Apache/2.2.9 (Debian) PHP/5.2.17-0.dotdeb.0 with Suhosin-Patch mod_ssl/2.2.9 OpenSSL/0.9.8g
Run Code Online (Sandbox Code Playgroud)

编辑:似乎,在不同的服务器上使用相同的证书不起作用.也许这被Apples服务器阻止了.

con*_*are 14

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

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

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
Run Code Online (Sandbox Code Playgroud)


Him*_*han 6

这种错误发生在两种情况:

  1. 当2195端口阻塞时.
  2. .pem文件没有正确地进行(如在我的情况).

试试这两点.你一定不会收到任何错误.