Agg*_*sor 8 push-notification apple-push-notifications ios
我已经阅读了关于这个问题的所有其他帖子,但仍无济于事.
我知道这个问题可能会出现错误的证书,但是在我将证书和密钥合并到我放在服务器上的单个.pem文件之前,我验证了它的证书和密钥都是有效的.
我完全不知道如何解决这个问题,所以我们非常感谢所有建议.这是我的服务器代码
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem');
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
// Open a connection to the APNS server
$fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx);
Run Code Online (Sandbox Code Playgroud)
PS ck.pem文件与读取权限设置在同一目录中.
这是完整的错误消息:
Warning: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in /var/www/site/pages/Callback.php on line 3515 Warning: stream_socket_client(): Failed to enable crypto in /var/www/site/pages/Callback.php on line 3515 Warning: stream_socket_client(): unable to connect to ssl://gateway.sandbox.push.apple.com:2195 (Unknown error) in /var/www/site/pages/Callback.php on line 3515 Failed to connect BECUSE OF ERROR: 0
UPDATE
It does seem to be a certificate validation issue after all but Im not sure why, when I check the ssl against APNS I get this error:
depth=1 /C=US/O=Entrust, Inc./OU=www.entrust.net/rpa is incorporated by reference/OU=(c) 2009 Entrust, Inc./CN=Entrust Certification Authority - L1C
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
0 s:/C=US/ST=California/L=Cupertino/O=Apple Inc./OU=iTMS Engineering/CN=gateway.sandbox.push.apple.com
i:/C=US/O=Entrust, Inc./OU=www.entrust.net/rpa is incorporated by reference/OU=(c) 2009 Entrust, Inc./CN=Entrust Certification Authority - L1C
1 s:/C=US/O=Entrust, Inc./OU=www.entrust.net/rpa is incorporated by reference/OU=(c) 2009 Entrust, Inc./CN=Entrust Certification Authority - L1C
i:/O=Entrust.net/OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)/OU=(c) 1999 Entrust.net Limited/CN=Entrust.net Certification Authority (2048)
---
No client certificate CA names sent
Run Code Online (Sandbox Code Playgroud)
下载entrust_2048_ca.cer
添加完整路径entrust_2048_ca.cer
/var/www/site/pages/entrust_2048_ca.cer
Run Code Online (Sandbox Code Playgroud)