我已经阅读了关于这个问题的所有其他帖子,但仍无济于事.
我知道这个问题可能会出现错误的证书,但我确认我的证书和我的密钥都是有效的,然后将它们合并到我放在服务器上的单个.pem文件中.
我完全不知道如何解决这个问题,所以非常感谢任何和所有的建议.这是我的服务器代码
$ctx = stream_context_create(); stream_context_set_option($ctx,'ssl','local_cert','ck.pem'); stream_context_set_option($ctx,'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);
附: 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./CN=Entrust Certification Authority - L1C 1 s:/C=US/O=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
下载entrust_2048_ca.cer
原文链接:https://www.f2er.com/php/137401.html添加完整路径到entrust_2048_ca.cer
/var/www/site/pages/entrust_2048_ca.cer